Describe the bug
If coverage.py with the sys.monitoring API is used at the same time as another tool is using it to collect coverage, an unhandled exception will be raised:
ValueError: tool 1 is already in use
To Reproduce
Using Python 3.12+
# repro.py
import sys
import coverage
tool_id = sys.monitoring.COVERAGE_ID
sys.monitoring.use_tool_id(tool_id, "another coverage tool")
cov = coverage.Coverage(config_file=False)
cov.start()
$ COVERAGE_CORE=sysmon python repro.py
Expected behavior
The Exception is handled instead of exiting the process.
Additional context
Add any other context about the problem here.
Describe the bug
If coverage.py with the
sys.monitoringAPI is used at the same time as another tool is using it to collect coverage, an unhandled exception will be raised:To Reproduce
Using Python 3.12+
$ COVERAGE_CORE=sysmon python repro.pyExpected behavior
The Exception is handled instead of exiting the process.
Additional context
Add any other context about the problem here.