Description
Describe the bug
(I'm crossposting SO post as I'm begin understanding how coverage test is working.)
I've been working on a PR for rpy2
package to improve its support for Windows, and the provided pytest
test hangs while running coverage.py
's tracer
only in Windows.
- The code base appears not to use any of the things mentioned in "Things that cause trouble."
- This test has been in use with GitHub Action for some time with my understanding (Windows test was never reached as the test previously failed in its earlier stage.)
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?
Python 3.9.7
- What version of coverage.py shows the problem? The output of
coverage debug sys
is helpful.
coverage 6.4.1
- What versions of what packages do you have installed? The output of
pip freeze
is helpful.
Package Version
--------------------- -----------
atomicwrites 1.4.0
attrs 21.4.0
certifi 2022.5.18.1
cffi 1.15.0
charset-normalizer 2.0.12
codecov 2.1.12
colorama 0.4.4
coverage 6.4.1
idna 3.3
iniconfig 1.1.1
Jinja2 3.1.2
MarkupSafe 2.1.1
packaging 21.3
pip 22.1.2
pluggy 1.0.0
py 1.11.0
pycparser 2.21
pyparsing 3.0.9
pytest 7.1.2
pytest-cov 3.0.0
pytz 2022.1
pytz-deprecation-shim 0.1.0.post0
requests 2.28.0
rpy2 3.5.3
setuptools 62.3.2
tomli 2.0.1
tzdata 2022.1
tzlocal 4.2
urllib3 1.26.9
wheel 0.37.1
- 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.
fix/win_r_home
branch of rpy2
fork
- What commands did you run?
coverage run --source rpy2.robjects.lib -m pytest rpy2/tests/robjects/lib
This command hangs after printing:
============================================= test session starts ==============================================
platform win32 -- Python 3.9.7, pytest-7.1.2, pluggy-1.0.0
rootdir: C:\Users\tikum\Documents\Python\rpy2
plugins: cov-3.0.0
collecting ...
Under a debugger, I can follow up until it reaches coverage.py
's Collector._start_tracer()
(collector.py
Line 278):
fn = tracer.start()
Then, it enters tracer
external module and never comes back out.
Removing --source rpy2.robjects.lib
argument makes the coverage to run normally. You can find the robjects/lib
subpackage here:
https://github.com/tikuma-lsuhsc/rpy2/tree/fix/win_r_home/rpy2/robjects/lib
Expected behavior
Not getting stuck...
Additional context
rpy2
package is a wrapper for R software and the target source modules do interact with R at the time of import
.