Skip to content

Commit

Permalink
Merge pull request #791 from hpc/789-pav-status-raises-exception-when…
Browse files Browse the repository at this point in the history
…-invoked-before-running-tests

Fix `pav status` Regression Test Passing When it Shouldn't
  • Loading branch information
hwikle-lanl authored Dec 5, 2024
2 parents 3c262de + 57ce1c6 commit 7121b81
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions test/tests/status_cmd_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,20 @@ def test_status_history(self):
def test_status_no_run(self):
"""Test that the status command behaves properly when invoked before any tests have run."""

# Create a temporary empty working directory to simulate a fresh install
self.pav_cfg.working_dir = self.pav_cfg.working_dir / "working_dir"
self.pav_cfg.working_dir.mkdir()

status_cmd = commands.get_command('status')
out = io.StringIO()
status_cmd.outfile = out
status_cmd.silence()

parser = argparse.ArgumentParser()
status_cmd._setup_arguments(parser)

args = parser.parse_args([])
self.assertEqual(status_cmd.run(self.pav_cfg, args), 0)
ret = status_cmd.run(self.pav_cfg, args)

# Reset working directory for other tests
self.pav_cfg.working_dir = self.pav_cfg.working_dir.parent

self.assertEqual(ret, 0)

0 comments on commit 7121b81

Please sign in to comment.