diff --git a/CHANGES.rst b/CHANGES.rst index 10c0c10..3565e3e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,11 @@ chronological order. Releases follow `semantic versioning ` all releases are available on `PyPI `_ and `Anaconda.org `_. +0.1.2 - 2022-xx-xx +------------------ + +- :gh:`36` adds a test for https://github.com/pytask-dev/pytask/issues/216. + 0.1.1 - 2022-02-08 ------------------ diff --git a/src/pytask_parallel/execute.py b/src/pytask_parallel/execute.py index 549e9c1..f8f93b2 100644 --- a/src/pytask_parallel/execute.py +++ b/src/pytask_parallel/execute.py @@ -179,6 +179,7 @@ def _unserialize_and_execute_task(bytes_, show_locals, console_options): def _process_exception( exc_info: tuple[Any], show_locals: bool, console_options: ConsoleOptions ) -> tuple[Any]: + """Process the exception and convert the traceback to a string.""" exc_info = remove_internal_traceback_frames_from_exc_info(exc_info) traceback = Traceback.from_exception(*exc_info, show_locals=show_locals) segments = console.render(traceback, options=console_options) diff --git a/tests/test_execute.py b/tests/test_execute.py index b0d7b6d..e91dc68 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -267,3 +267,29 @@ def task_raising_error(): assert "───── Traceback" in result.output assert ("───── locals" in result.output) is show_locals assert ("[0, 1, 2, 3, 4]" in result.output) is show_locals + + +@pytest.mark.end_to_end +@pytest.mark.parametrize("parallel_backend", PARALLEL_BACKENDS) +def test_generators_are_removed_from_depends_on_produces(tmp_path, parallel_backend): + """Only works with pytask >=0.1.9.""" + source = """ + from pathlib import Path + import pytask + + @pytask.mark.parametrize("produces", [ + ((x for x in ["out.txt", "out_2.txt"]),), + ["in.txt"], + ]) + def task_example(produces): + produces = {0: produces} if isinstance(produces, Path) else produces + for p in produces.values(): + p.write_text("hihi") + """ + tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source)) + + session = main( + {"paths": tmp_path, "parallel_backend": parallel_backend, "n_workers": 2} + ) + + assert session.exit_code == 0