ansys/pyaedt

Enabling coverage globally for pytest prevents pydev debugger from working

isaacwaldron opened this issue · 1 comments

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.

@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.