-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use addressing instead of name (#62)
* use addressing instead of name * test for nested dvc yam files * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
2c72414
commit 81a097c
Showing
2 changed files
with
63 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
"""Test repository with multiple dvc.yaml files.""" | ||
|
||
import os | ||
import subprocess | ||
|
||
import git | ||
import pytest | ||
import yaml | ||
from typer.testing import CliRunner | ||
|
||
from paraffin.cli import app | ||
|
||
runner = CliRunner() | ||
|
||
dvc_yaml_dict = { | ||
"stages": { | ||
"01_preprocessing": { | ||
"outs": ["output"], | ||
"cmd": [ | ||
"""bash -euo pipefail << EOF | ||
# add bash code here | ||
mkdir -p output && echo "Hello World" > output/hello.txt | ||
EOF""" | ||
], | ||
} | ||
} | ||
} | ||
|
||
|
||
@pytest.fixture | ||
def nested_project(tmp_path): | ||
subprocess.check_call(["git", "init"], cwd=tmp_path) | ||
subprocess.check_call(["dvc", "init"], cwd=tmp_path) | ||
|
||
(tmp_path / "dvc.yaml").touch() | ||
exp1 = tmp_path / "exp1" | ||
exp1.mkdir() | ||
|
||
(exp1 / "dvc.yaml").write_text(yaml.dump(dvc_yaml_dict)) | ||
|
||
repo = git.Repo(tmp_path) | ||
repo.git.add(all=True) | ||
repo.index.commit("Initial commit") | ||
|
||
return tmp_path | ||
|
||
|
||
def test_053(nested_project): | ||
os.chdir(nested_project) | ||
# subprocess.check_call(["dvc repro"], shell=True) | ||
|
||
result = runner.invoke(app, "submit") | ||
assert result.exit_code == 0 | ||
|
||
result = runner.invoke(app, "worker") | ||
assert result.exit_code == 0 | ||
|
||
assert ( | ||
nested_project / "exp1" / "output" / "hello.txt" | ||
).read_text() == "Hello World\n" |