-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
119 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import os | ||
import pytest | ||
import subprocess | ||
|
||
pytest.TORCH_PREFIX = './.venv-pytorch' | ||
pytest.TF_PREFIX = './.venv-tf' | ||
|
||
FNAMES = [ | ||
'pipeline.yaml', | ||
'startscript', | ||
'train.py', | ||
] | ||
|
||
|
||
@pytest.fixture | ||
def check_folder_structure(): | ||
""" | ||
Verify that the use case folder complies with some predefined | ||
structure. | ||
""" | ||
def _check_structure(root: str): | ||
for fname in FNAMES: | ||
fpath = os.path.join(root, fname) | ||
assert os.path.isfile(fpath), f"'{fname}' is missing in '{fpath}'" | ||
return _check_structure | ||
|
||
|
||
@pytest.fixture | ||
def install_requirements(): | ||
"""Install requirements.txt, if present in root folder.""" | ||
def _install_reqs(root: str, env_prefix: str): | ||
req_path = os.path.join(root, 'requirements.txt') | ||
if os.path.isfile(req_path): | ||
cmd = (f"micromamba run -p {env_prefix} " | ||
f"pip install -r {req_path}") | ||
subprocess.run(cmd.split(), check=True) | ||
return _install_reqs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters