diff --git a/looper/utils.py b/looper/utils.py index aaee2333..1ba6af9e 100644 --- a/looper/utils.py +++ b/looper/utils.py @@ -605,7 +605,7 @@ def is_registry_path(input_string: str) -> bool: :return bool: True if input is a registry path """ try: - if input_string.endswith(".yaml"): + if input_string.endswith(".yaml") or input_string.endswith(".csv"): return False except AttributeError: raise RegistryPathException( diff --git a/tests/conftest.py b/tests/conftest.py index ac8f71a2..0293bd80 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -230,6 +230,24 @@ def prep_temp_pep_basic(example_pep_piface_path): return path_to_looper_config +@pytest.fixture +def prep_temp_pep_csv(example_pep_piface_path): + + # Get Path to local copy of hello_looper + hello_looper_dir_path = os.path.join( + example_pep_piface_path, "hello_looper-dev_derive" + ) + + # Make local temp copy of hello_looper + d = tempfile.mkdtemp() + shutil.copytree(hello_looper_dir_path, d, dirs_exist_ok=True) + + advanced_dir = os.path.join(d, "csv") + path_to_looper_config = os.path.join(advanced_dir, ".looper.yaml") + + return path_to_looper_config + + @pytest.fixture def prep_temp_config_with_pep(example_pep_piface_path): # temp dir diff --git a/tests/smoketests/test_run.py b/tests/smoketests/test_run.py index ee1d54cc..18c10f98 100644 --- a/tests/smoketests/test_run.py +++ b/tests/smoketests/test_run.py @@ -23,6 +23,16 @@ def test_cli(prep_temp_pep): raise pytest.fail("DID RAISE {0}".format(Exception)) +def test_running_csv_pep(prep_temp_pep_csv): + tp = prep_temp_pep_csv + + x = ["run", "--looper-config", tp, "--dry-run"] + try: + main(test_args=x) + except Exception: + raise pytest.fail("DID RAISE {0}".format(Exception)) + + def is_connected(): """Determines if local machine can connect to the internet.""" import socket @@ -597,3 +607,14 @@ def test_init_project_using_dict(self, prep_temp_config_with_pep): ) assert len(init_project.pipeline_interfaces) == 3 + + def test_init_project_using_csv(self, prep_temp_pep_csv): + """Verify looper runs using pephub in a basic case and return code is 0""" + tp = prep_temp_pep_csv + with mod_yaml_data(tp) as config_data: + pep_config_csv = config_data["pep_config"] + + pep_config_csv = os.path.join(os.path.dirname(tp), pep_config_csv) + init_project = Project(cfg=pep_config_csv) + + assert len(init_project.samples) == 2