Skip to content

Commit

Permalink
use addressing instead of name (#62)
Browse files Browse the repository at this point in the history
* 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
PythonFZ and pre-commit-ci[bot] authored Feb 4, 2025
1 parent 2c72414 commit 81a097c
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
2 changes: 1 addition & 1 deletion paraffin/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def changed(self) -> bool:
@property
def name(self) -> str:
"""Return the name of the stage."""
return self.stage.name
return self.stage.addressing

@property
def cmd(self) -> str:
Expand Down
62 changes: 62 additions & 0 deletions tests/integration/test_multiple_yaml.py
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"

0 comments on commit 81a097c

Please sign in to comment.