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

Enabling coverage globally for pytest prevents pydev debugger from working #5216

Open
isaacwaldron opened this issue Sep 26, 2024 · 1 comment

Comments

@isaacwaldron
Copy link
Contributor

This line in pyproject.toml globally enables coverage reporting for all pytest runs, including those runs intended to be run in a debugger. This causes the pydev debugger (used by VS Code) to stop working properly. The following message is printed and in general breakpoints fail to work:

PYDEV DEBUGGER WARNING:
sys.settrace() should not be used when the debugger is being used.
This may cause the debugger to stop working correctly.
If this is needed, please check:
http://pydev.blogspot.com/2007/06/why-cant-pydev-debugger-work-with.html
to see how to restore the debug tracing back correctly.
Call Location:
  File "c:\git\Ansys\pyaedt\venv\lib\site-packages\coverage\collector.py", line 302, in _installation_trace
    sys.settrace(None)

Given this behavior, coverage reporting should only be enabled for CI test runs during the GitHub workflows and not as a global state for all pytest runs.

@SMoraisAnsys
Copy link
Collaborator

SMoraisAnsys commented Sep 27, 2024

@Samuelopez-ansys I know that other people have to tune their IDE to avoid this coverage by default. Could we follow the approach of Isaac and only do that during CICD ? We could leave the current configuration commented and update the CICD to trigger the coverage. This way, if one wanted to have the coverage locally, he would only have to uncomment the setting.
Feel free to assign me this issue if you want to proceed :)
The other approach is to ask users to comment it themselves though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants