Skip to content

Test that internal tracebacks are removed by reports. #465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 26, 2023
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
2 changes: 2 additions & 0 deletions docs/source/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
- {pull}`459` adds a pre-commit hook to sort `__all__`.
- {pull}`460` simplifies removing internal tracebacks from exceptions with a cause.
- {pull}`463` raise error when a task function is not defined inside the loop body.
- {pull}`464` improves pinned dependencies.
- {pull}`465` adds test to ensure internal tracebacks are removed by reports.

## 0.4.1 - 2023-10-11

Expand Down
6 changes: 5 additions & 1 deletion tests/test_collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def task_write_text(depends_on, produces):


@pytest.mark.end_to_end()
def test_collect_depends_on_that_is_not_str_or_path(tmp_path):
def test_collect_depends_on_that_is_not_str_or_path(capsys, tmp_path):
"""If a node cannot be parsed because unknown type, raise an error."""
source = """
import pytask
Expand All @@ -57,6 +57,10 @@ def task_with_non_path_dependency():
assert isinstance(exc_info[1], NodeNotCollectedError)
assert "'@pytask.mark.depends_on'" in str(exc_info[1])

# Assert tracebacks are hidden.
captured = capsys.readouterr()
assert "_pytask/collect.py" not in captured.out


@pytest.mark.end_to_end()
def test_collect_produces_that_is_not_str_or_path(tmp_path):
Expand Down
3 changes: 3 additions & 0 deletions tests/test_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ def task_d(produces):
assert tmp_path.joinpath("in.txt").as_posix() not in result.output
assert tmp_path.name + "/in.txt" in result.output

# Test whether reports remove inner tracebacks
assert "/_pytask/dag.py" not in result.output


@pytest.mark.end_to_end()
def test_check_if_root_nodes_are_available_w_name(tmp_path, runner):
Expand Down