Skip to content

Commit

Permalink
add check for output directory to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sfmig committed Oct 4, 2023
1 parent 5555fba commit 654ff31
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion brainglobe_workflows/cellfinder/cellfinder_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def setup_workflow(cellfinder_cache_dir=CELLFINDER_CACHE_DIR):
timestamp = datetime.datetime.now()
timestamp_formatted = timestamp.strftime("%Y%m%d_%H%M%S")
output_path_timestamped = Path(
str(config.output_path) + timestamp_formatted
str(config.output_path_basename) + timestamp_formatted
)
output_path_timestamped.mkdir(parents=True, exist_ok=True)
# add to config
Expand Down
8 changes: 8 additions & 0 deletions tests/test_integration/test_cellfinder_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def test_run_with_env_var_config(config_from_env_var, caplog, logger_str):
"provided GIN repository" in caplog.messages
)

# check output directory and output file exist
assert Path(cfg.output_path).exists()
assert (Path(cfg.output_path) / cfg.detected_cells_filename).is_file()


def test_run_with_default_config(cellfinder_cache_dir, caplog, logger_str):
# check environment var is not defined
Expand All @@ -92,6 +96,10 @@ def test_run_with_default_config(cellfinder_cache_dir, caplog, logger_str):
"provided GIN repository" in caplog.messages
)

# check output directory and output file exist
assert Path(cfg.output_path).exists()
assert (Path(cfg.output_path) / cfg.detected_cells_filename).is_file()


# test running on local data?
# def test_run_with_default_config_local(
Expand Down

0 comments on commit 654ff31

Please sign in to comment.