Describe the bug
When I use coverage, pytest, and traceback.print_stack() together, I get a deprecation warning on 3.15. I'm not convinced it's coverage's fault, but opening here first.
To Reproduce
x.py:
import traceback
traceback.print_stack()
Now run coverage run -m pytest x.py (after pip install coverage pytest). Note that the pytest part and the coverage part is necessary, if it's missing either things work correctly. You should see something like this:
a5rocks@whimsy /v/f/p/j/T/tmp.yE0qQYS20D> uv run coverage run -m pytest x.py
==================================== test session starts ====================================
platform darwin -- Python 3.15.0a6, pytest-9.1.1, pluggy-1.6.0
rootdir: /private/var/folders/py/j2lyj17j2sxg5xgjg2sxkx1h0000gn/T/tmp.yE0qQYS20D
collected 0 items
===================================== warnings summary ======================================
../../../../../../../Users/a5rocks/.local/share/uv/python/cpython-3.15.0a6-macos-aarch64-none/lib/python3.15/linecache.py:273
/Users/a5rocks/.local/share/uv/python/cpython-3.15.0a6-macos-aarch64-none/lib/python3.15/linecache.py:273: DeprecationWarning: Module globals; __loader__ != __spec__.loader
warnings.warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
==================================== 1 warning in 0.00s =====================================
Answer the questions below:
- What version of Python are you using? 3.15.0a6
- What version of coverage.py shows the problem? The output of
coverage debug sys is helpful. 7.14.1
- What versions of what packages do you have installed? The output of
pip freeze is helpful. pytest==9.0.3 also
- What code shows the problem? Give us a specific commit of a specific repo that we can check out. If you've already worked around the problem, please provide a commit before that fix.
x.py above
- What commands should we run to reproduce the problem? Be specific. Include everything, even
git clone, pip install, and so on. Explain like we're five! command given above.
Expected behavior
No deprecation warning.
Describe the bug
When I use
coverage,pytest, andtraceback.print_stack()together, I get a deprecation warning on 3.15. I'm not convinced it'scoverage's fault, but opening here first.To Reproduce
x.py:Now run
coverage run -m pytest x.py(afterpip install coverage pytest). Note that thepytestpart and thecoveragepart is necessary, if it's missing either things work correctly. You should see something like this:Answer the questions below:
coverage debug sysis helpful. 7.14.1pip freezeis helpful.pytest==9.0.3alsox.pyabovegit clone,pip install, and so on. Explain like we're five! command given above.Expected behavior
No deprecation warning.