Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning "Module x was never imported" when running with xdist (reopen) #378

Closed
cjolowicz opened this issue Jan 7, 2020 · 1 comment · Fixed by #382
Closed

warning "Module x was never imported" when running with xdist (reopen) #378

cjolowicz opened this issue Jan 7, 2020 · 1 comment · Fixed by #382

Comments

@cjolowicz
Copy link

cjolowicz commented Jan 7, 2020

This may be the same issue as #212. If you prefer to reopen that issue, I can repost there.

When using pytest-cov with pytest-xdist, Coverage.py displays the warnings module-not-imported and no-data-collected, even though coverage does get collected and reported:

$ pytest --cov=foobar -n auto

=== test session starts ===
platform darwin -- Python 3.8.1, pytest-5.3.2, py-1.8.1, pluggy-0.13.1
rootdir: /private/tmp/foobar
plugins: xdist-1.31.0, forked-1.1.3, cov-2.8.1
gw0 [1] / gw1 [1] / gw2 [1] / gw3 [1]
.   [100%]
Coverage.py warning: Module foobar was never imported. (module-not-imported)
Coverage.py warning: No data was collected. (no-data-collected)


--- coverage: platform darwin, python 3.8.1-final-0 ---
Name                                                   Stmts   Miss  Cover
---
.venv/lib/python3.8/site-packages/foobar/__init__.py       1      0   100%

=== 1 passed in 0.98s ===

Repro: https://github.com/cjolowicz/pytest-cov-issue-378

git clone https://github.com/cjolowicz/pytest-cov-issue-378.git
cd pytest-cov-issue-378/
pyenv local 3.8.1
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install .
pytest --cov=foobar -n auto
@cjolowicz
Copy link
Author

For the record, configuring Coverage.py does not seem to help:

# .coveragerc
[paths]
source =
    src
    */site-packages

[run]
branch = true
source = foobar
concurrency = multiprocessing
parallel = true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant