Skip to content

Commit

Permalink
Fix unit test for status command before running tests
Browse files Browse the repository at this point in the history
This commit fixes an issue in which a recently committed regression
test passes even when it shouldn't. The test should now fail if the
regression is reintroduced.
  • Loading branch information
hwikle-lanl committed Nov 21, 2024
1 parent f2d5307 commit 57ce1c6
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 57ce1c6

Please sign in to comment.