Skip to content

Commit

Permalink
add checking for pep file type and simple test
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldcampbelljr committed Mar 19, 2024
1 parent 199ba63 commit 11517ed
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
15 changes: 15 additions & 0 deletions looper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,21 @@ def dotfile_path(directory=os.getcwd(), must_exist=False):
cur_dir = parent_dir


def is_PEP_file_type(input_string: str) -> bool:
"""
Determines if the provided path is actually a file type that Looper can use for loading PEP
"""

PEP_FILE_TYPES = ["yaml", "csv"]

parsed_path = parse_registry_path(input_string)

if parsed_path["subitem"] in PEP_FILE_TYPES:
return True
else:
return False


def is_registry_path(input_string: str) -> bool:
"""
Check if input is a registry path to pephub
Expand Down
9 changes: 9 additions & 0 deletions tests/smoketests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ def test_running_csv_pep(prep_temp_pep_csv):
raise pytest.fail("DID RAISE {0}".format(Exception))


@pytest.mark.parametrize(
"path", ["something/example.yaml", "somethingelse/example2.csv"]
)
def test_is_PEP_file_type(path):

result = is_PEP_file_type(path)
assert result == True


def is_connected():
"""Determines if local machine can connect to the internet."""
import socket
Expand Down

0 comments on commit 11517ed

Please sign in to comment.