Skip to content

Commit

Permalink
Test now covers dir with missing pipe file
Browse files Browse the repository at this point in the history
  • Loading branch information
ppinchuk committed Sep 22, 2023
1 parent e30ae19 commit 842e3e1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/cli/test_cli_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def test_pipeline_command_recursive(
tmp_cwd / "test_run_2" / "test_run_3",
tmp_cwd / "test_run_4",
tmp_cwd / "test_run_5",
tmp_cwd / "test_run_6",
]

for prev_dir, next_dir in zip(test_dirs[0:-1], test_dirs[1:]):
Expand All @@ -273,28 +274,30 @@ def test_pipeline_command_recursive(
assert not config.read()

shutil.copy(
test_dirs[-1] / "config_pipeline.json",
test_dirs[-1] / "config_pipeline2.json",
test_dirs[-2] / "config_pipeline.json",
test_dirs[-2] / "config_pipeline2.json",
)
(test_dirs[-1] / "config_pipeline.json").unlink()

pipe = pipeline_command({})
cli_runner.invoke(pipe, ["-r"])
cli_runner.invoke(pipe, ["-r"])

for test_dir in test_dirs[:-1]:
for test_dir in test_dirs[:-2]:
assert_message_was_logged(test_dir.name, "INFO")
with open(test_dir / "config_run.json", "r") as config:
assert json.load(config) == SUCCESS_CONFIG

with open(test_dirs[-1] / "config_run.json", "r") as config:
assert not config.read()
for test_dir in test_dirs[-2:]:
with open(test_dir / "config_run.json", "r") as config:
assert not config.read()

assert_message_was_logged("Pipeline job", "INFO")
assert_message_was_logged("is complete.", "INFO")
assert_message_was_logged(
"Could not determine config file - multiple files detected", "WARNING"
)
assert_message_was_logged(test_dirs[-1].name, "WARNING")
assert_message_was_logged(test_dirs[-2].name, "WARNING")


if __name__ == "__main__":
Expand Down

0 comments on commit 842e3e1

Please sign in to comment.