Skip to content

Commit

Permalink
Modify derived attribute path before running samples #464
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldcampbelljr committed Feb 26, 2024
1 parent 6b2c599 commit d4cfe23
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions tests/test_comprehensive.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from tempfile import TemporaryDirectory
from git import Repo

from yaml import dump, safe_load

CMD_STRS = ["string", " --string", " --sjhsjd 212", "7867#$@#$cc@@"]

REPO_URL = "https://github.com/pepkit/hello_looper.git"
Expand All @@ -35,15 +37,29 @@ def test_comprehensive_looper_pipestat():
cmd = "run"

with TemporaryDirectory() as d:
repo = Repo.clone_from(REPO_URL, d)

# TODO executing either the .py or the .sh pipeline does not correctly report results because pytest is running from a different directory
repo = Repo.clone_from(REPO_URL, d, branch="dev_derive")
pipestat_dir = os.path.join(d, "pipestat")
os.chdir(pipestat_dir)

path_to_looper_config = os.path.join(pipestat_dir, ".looper_pipestat_shell.yaml")
path_to_looper_config = os.path.join(
pipestat_dir, ".looper_pipestat_shell.yaml"
)

# open up the project config and replace the derived attributes with the path to the data. In a way, this simulates using the environment variables.
pipestat_project_file = os.path.join(
d, "pipestat/project", "project_config.yaml"
)
with open(pipestat_project_file, "r") as f:
pipestat_project_data = safe_load(f)

pipestat_project_data["sample_modifiers"]["derive"]["sources"]["source1"] = (
os.path.join(pipestat_dir, "data/{sample_name}.txt")
)

with open(pipestat_project_file, "w") as f:
dump(pipestat_project_data, f)

x = [cmd, "-d", "--looper-config", path_to_looper_config]
# x = [cmd, "-d", "--looper-config", path_to_looper_config]
x = [cmd, "--looper-config", path_to_looper_config]

try:
result = main(test_args=x)
Expand Down

0 comments on commit d4cfe23

Please sign in to comment.