|
12 | 12 | @pytest.mark.end_to_end()
|
13 | 13 | @pytest.mark.parametrize(
|
14 | 14 | "dependencies",
|
15 |
| - [[], ["in.txt"], ["in_1.txt", "in_2.txt"]], |
| 15 | + [(), ("in.txt",), ("in_1.txt", "in_2.txt")], |
16 | 16 | )
|
17 |
| -@pytest.mark.parametrize("products", [["out.txt"], ["out_1.txt", "out_2.txt"]]) |
| 17 | +@pytest.mark.parametrize("products", [("out.txt",), ("out_1.txt", "out_2.txt")]) |
18 | 18 | def test_execution_w_varying_dependencies_products(
|
19 | 19 | runner, tmp_path, dependencies, products
|
20 | 20 | ):
|
21 | 21 | source = f"""
|
22 | 22 | import pytask
|
23 | 23 | from pathlib import Path
|
24 | 24 |
|
25 |
| - @pytask.mark.depends_on({dependencies}) |
26 |
| - @pytask.mark.produces({products}) |
27 |
| - def task_example(depends_on, produces): |
| 25 | + def task_example( |
| 26 | + depends_on=[Path(p) for p in {dependencies}], |
| 27 | + produces=[Path(p) for p in {products}], |
| 28 | + ): |
28 | 29 | if isinstance(produces, dict):
|
29 | 30 | produces = produces.values()
|
30 | 31 | elif isinstance(produces, Path):
|
31 | 32 | produces = [produces]
|
32 | 33 | for product in produces:
|
33 | 34 | product.touch()
|
34 | 35 | """
|
35 |
| - tmp_path.joinpath("task_example.py").write_text(textwrap.dedent(source)) |
| 36 | + tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source)) |
36 | 37 | for dependency in dependencies:
|
37 | 38 | tmp_path.joinpath(dependency).touch()
|
38 | 39 |
|
|
0 commit comments