From 654ff31dece02f09b9ac7de18a1c690a97cded09 Mon Sep 17 00:00:00 2001 From: sfmig <33267254+sfmig@users.noreply.github.com> Date: Wed, 4 Oct 2023 19:31:14 +0100 Subject: [PATCH] add check for output directory to tests --- brainglobe_workflows/cellfinder/cellfinder_main.py | 2 +- tests/test_integration/test_cellfinder_workflow.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/brainglobe_workflows/cellfinder/cellfinder_main.py b/brainglobe_workflows/cellfinder/cellfinder_main.py index 2c4bf30e..acea6498 100644 --- a/brainglobe_workflows/cellfinder/cellfinder_main.py +++ b/brainglobe_workflows/cellfinder/cellfinder_main.py @@ -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 diff --git a/tests/test_integration/test_cellfinder_workflow.py b/tests/test_integration/test_cellfinder_workflow.py index 765939ca..a4128fd7 100644 --- a/tests/test_integration/test_cellfinder_workflow.py +++ b/tests/test_integration/test_cellfinder_workflow.py @@ -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 @@ -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(