Skip to content
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

Tracebacks from collection errors are not pruned #11710

Closed
bluetech opened this issue Dec 16, 2023 · 0 comments · Fixed by #11711
Closed

Tracebacks from collection errors are not pruned #11710

bluetech opened this issue Dec 16, 2023 · 0 comments · Fixed by #11711
Assignees
Labels
topic: collection related to the collection phase topic: tracebacks related to displaying and handling of tracebacks type: bug problem that needs to be addressed type: regression indicates a problem that was introduced in a release which was working previously

Comments

@bluetech
Copy link
Member

This is a regression in pytest 7.4 from commit fcada1e.

Given a test module

raise Exception('foo')

Expected output:

_______ ERROR collecting yy/test_y.py _______
yy/test_y.py:1: in <module>
    raise Exception('foo')
E   Exception: foo

Actual output:

_______ ERROR collecting yy/test_y.py _______
src/_pytest/runner.py:340: in from_call
    result: Optional[TResult] = func()
src/_pytest/runner.py:371: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
src/_pytest/python.py:579: in collect
    self._inject_setup_module_fixture()
src/_pytest/python.py:593: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
src/_pytest/python.py:307: in obj
    self._obj = obj = self._getobj()
src/_pytest/python.py:576: in _getobj
    return importtestmodule(self.path, self.config)
src/_pytest/python.py:528: in importtestmodule
    mod = import_path(path, mode=importmode, root=config.rootpath)
src/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1147: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:690: in _load_unlocked
    ???
src/_pytest/assertion/rewrite.py:175: in exec_module
    exec(co, module.__dict__)
yy/test_y.py:1: in <module>
    raise Exception('foo')
E   Exception: foo
@bluetech bluetech added type: bug problem that needs to be addressed topic: tracebacks related to displaying and handling of tracebacks topic: collection related to the collection phase type: regression indicates a problem that was introduced in a release which was working previously labels Dec 16, 2023
@bluetech bluetech self-assigned this Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: collection related to the collection phase topic: tracebacks related to displaying and handling of tracebacks type: bug problem that needs to be addressed type: regression indicates a problem that was introduced in a release which was working previously
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant