coverage 6.3 failed for parallel execution · Issue #1312 · nedbat/coveragepy (original) (raw)
Describe the bug
A clear and concise description of the bug.
To Reproduce
How can we reproduce the problem? Please be specific. Don't link to a failing CI job. Answer the questions below:
- What version of Python are you using?
3.8.12 - What version of coverage.py shows the problem? The output of
coverage debug sys
is helpful.
6.3 - What versions of what packages do you have installed? The output of
pip freeze
is helpful.
pytest =6.2.5
coverage=6.3 - 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.
- What commands did you run?
pytest --cov-config=.coveragerc --cov=../our_code --workers auto --durations=0
Expected behavior
It should run tests in parallel and generate code coverage
Additional context
Getting error messages
_```
______________ ERROR at setup of TestTracing.test_trace_results _______________
self = <pytest_cov.plugin.CovPlugin object at 0x7fc911671040>
item =
def pytest_runtest_setup(self, item):
if os.getpid() != self.pid:
# test is run in another process than session, run
# coverage manually
/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pytest_cov/plugin.py:350:
/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pytest_cov/embed.py:74: in init
cov.start()
/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/coverage/control.py:567: in start
self._init_for_start()
/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/coverage/control.py:536: in _init_for_start
self._old_sigterm = signal.signal(signal.SIGTERM, self._on_sigterm)
signalnum = <Signals.SIGTERM: 15>
handler = <bound method Coverage._on_sigterm of <coverage.control.Coverage object at 0x7fc8ed755ee0>>
@_wraps(_signal.signal)
def signal(signalnum, handler):
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
E ValueError: signal only works in main thread
/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/signal.py:47: ValueError
_______________ ERROR at setup of TestDistributions.test_exp2inf _______________
self = <pytest_cov.plugin.CovPlugin object at 0x7fc911671040>
item =
def pytest_runtest_setup(self, item):
if os.getpid() != self.pid:
# test is run in another process than session, run
# coverage manually
/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pytest_cov/plugin.py:350:
/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pytest_cov/embed.py:74: in init
cov.start()
/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/coverage/control.py:567: in start
self._init_for_start()
/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/coverage/control.py:536: in _init_for_start
self._old_sigterm = signal.signal(signal.SIGTERM, self._on_sigterm)
signalnum = <Signals.SIGTERM: 15>
handler = <bound method Coverage._on_sigterm of <coverage.control.Coverage object at 0x7fc8ed7de5e0>>
@_wraps(_signal.signal)
def signal(signalnum, handler):
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
E ValueError: signal only works in main thread
/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/signal.py:47: ValueError