Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion docs/source/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion src/_pytask/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
22 changes: 22 additions & 0 deletions tests/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)