Skip to content

Commit

Permalink
Update tests for pytask v0.5. (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasraabe authored May 26, 2024
1 parent 612aca3 commit fd38898
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 6 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ chronological order. Releases follow [semantic versioning](https://semver.org/)
releases are available on [PyPI](https://pypi.org/project/pytask-stata) and
[Anaconda.org](https://anaconda.org/conda-forge/pytask-stata).

## 0.4.0 - 2023-10-08
## 0.4.1 - 2024-xx-xx

- {pull}`37` updates the CI.
- {pull}`38` updates tests for pytask v0.5.

## 0.4.0 - 2024-03-19

- {pull}`36` makes pytask-stata compatible with pytask v0.4.0.

Expand Down
13 changes: 7 additions & 6 deletions tests/test_normal_execution_w_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,28 @@
@pytest.mark.end_to_end()
@pytest.mark.parametrize(
"dependencies",
[[], ["in.txt"], ["in_1.txt", "in_2.txt"]],
[(), ("in.txt",), ("in_1.txt", "in_2.txt")],
)
@pytest.mark.parametrize("products", [["out.txt"], ["out_1.txt", "out_2.txt"]])
@pytest.mark.parametrize("products", [("out.txt",), ("out_1.txt", "out_2.txt")])
def test_execution_w_varying_dependencies_products(
runner, tmp_path, dependencies, products
):
source = f"""
import pytask
from pathlib import Path
@pytask.mark.depends_on({dependencies})
@pytask.mark.produces({products})
def task_example(depends_on, produces):
def task_example(
depends_on=[Path(p) for p in {dependencies}],
produces=[Path(p) for p in {products}],
):
if isinstance(produces, dict):
produces = produces.values()
elif isinstance(produces, Path):
produces = [produces]
for product in produces:
product.touch()
"""
tmp_path.joinpath("task_example.py").write_text(textwrap.dedent(source))
tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source))
for dependency in dependencies:
tmp_path.joinpath(dependency).touch()

Expand Down

0 comments on commit fd38898

Please sign in to comment.