diff --git a/docs/source/changes.md b/docs/source/changes.md index 5f30e3a3..c05fd9eb 100644 --- a/docs/source/changes.md +++ b/docs/source/changes.md @@ -5,7 +5,15 @@ chronological order. Releases follow [semantic versioning](https://semver.org/) releases are available on [PyPI](https://pypi.org/project/pytask) and [Anaconda.org](https://anaconda.org/conda-forge/pytask). -## 0.2.3 - 2022-xx-xx +## 0.2.4 - 2022-xx-xx + +- {pull}`279` enhances some tutorials with spell and grammar checking. +- {pull}`282` updates the tox configuration. +- {pull}`283` fixes an issue with coverage and tests using pexpect + `pdb.set_trace()`. +- {pull}`285` implements that pytask does not show the traceback of tasks which are + skipped because its previous task failed. Fixes {issue}`284`. + +## 0.2.3 - 2022-05-30 - {pull}`276` fixes `pytask clean` when git is not installed. Fixes {issue}`275`. - {pull}`277` ignores `DeprecationWarning` and `PendingDeprecationWarning` by default. diff --git a/src/_pytask/execute.py b/src/_pytask/execute.py index 8c1609e7..320bda73 100644 --- a/src/_pytask/execute.py +++ b/src/_pytask/execute.py @@ -250,7 +250,10 @@ def pytask_execute_log_end(session: Session, reports: list[ExecutionReport]) -> console.print() for report in reports: - if report.outcome in (TaskOutcome.FAIL, TaskOutcome.SKIP_PREVIOUS_FAILED): + if report.outcome == TaskOutcome.FAIL or ( + report.outcome == TaskOutcome.SKIP_PREVIOUS_FAILED + and session.config["verbose"] >= 2 + ): _print_errored_task_report(session, report) console.rule(style="dim") diff --git a/tests/test_execute.py b/tests/test_execute.py index 672efbc4..aa1e80a9 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -308,3 +308,25 @@ def task_error(): raise ValueError assert len(matches_traceback) == 2 else: assert len(matches_traceback) == 1 + + +@pytest.mark.end_to_end +@pytest.mark.parametrize("verbose", [1, 2]) +def test_traceback_of_previous_task_failed_is_not_shown(runner, tmp_path, verbose): + source = """ + import pytask + + @pytask.mark.produces("in.txt") + def task_first(): raise ValueError + + @pytask.mark.depends_on("in.txt") + def task_second(): pass + """ + tmp_path.joinpath("task_example.py").write_text(textwrap.dedent(source)) + + result = runner.invoke(cli, [tmp_path.as_posix(), "--verbose", str(verbose)]) + + assert result.exit_code == ExitCode.FAILED + assert ("Task task_example.py::task_second failed" in result.output) is ( + verbose == 2 + )