Description
Summary
Basically I am unable to run test coverage on a project that includes both ddtrace and pytest-cov
Expected vs actual result
I should be able to do so
Reproducer
In order to reproduce I have a very simple project with
[tool.poetry.dependencies]
python = "^3.12"
pytest = "^8.3.3"
pytest-cov = "^6.0.0"
ddtrace = "2.12.0"
And a test file
def test_ddtrace_coverage():
assert 1 == 1
Whenever I run the command COVERAGE_FILE=foo COVERAGE_CORE=sysmon pytest --cov=. tests/test_ddtrace_coverage.py
I get the following error
File "/Users/didierdarricau/Library/Caches/pypoetry/virtualenvs/ddtrace-coverage-test-5TsU0QvL-py3.12/lib/python3.12/site-packages/coverage/sysmon.py", line 226, in start
sys_monitoring.use_tool_id(self.myid, "coverage.py")
ValueError: tool 1 is already in use
Note that this only happens when using the COVERAGE_CORE=sysmon
flag, it seems that both ddtrace and pytest-cov request the same tool_id in that module. Note that using this flag is important to me as it significantly shortens the CI run time at my job.
I am not sure who should resolve the issue so I am also posting an issue on the pytest-cov repo.
Also not that if I use a ddtrace version < 2.12.0
it works fine.