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 #212

Closed
anthrotype opened this issue Jul 5, 2018 · 5 comments
Closed

warning "Module x was never imported" when running with xdist #212

anthrotype opened this issue Jul 5, 2018 · 5 comments

Comments

@anthrotype
Copy link

If I install pytest-xdist plugin, and run pytest --cov with some -n number of parallel processes (even with -n 1), I get this warnings at the end:

Coverage.py warning: Module psautohint was never imported. (module-not-imported)
Coverage.py warning: No data was collected. (no-data-collected)

However, the data is collected, the .coverage.* data file is created, and a report is printed correctly despite the warnings.

If I run without passing the -n xdist option, so not in parallel, I don't get any such warnings.
Similarly I don't get those warning if I run coverage run -m pytest instead of pytest --cov.

I have a .coveragerc file in the root of the repository which contains this:

source = psautohint

[paths]
source =
    src/psautohint
    .tox/*/lib/python*/site-packages/psautohint
    .tox/*/lib/site-packages/psautohint
    .tox/pypy*/site-packages/psautohint
@anthrotype
Copy link
Author

I'm using an src layout to avoid implicit import: the package named psautohint is not at the root of the repository, where .coveragerc and tox.ini are located, but it is inside the 'src' subfolder.

According to coverage docs, the source option in .coveragerc file can be either a filesystem path or the import name of a package. In my case it is the latter.

I use the paths option to treat all those listed as equivalent when combining coverage.

This always worked fine when running coverage run --parallel-mode -m pytest, followed by a final coverage combine (and codecov to upload the report).

I would like to try using pytest-cov plugin, but that warning tells me I may be doing something wrong?

@ionelmc
Copy link
Member

ionelmc commented Aug 9, 2018

How can I reproduce this? Enough to checkout https://github.com/adobe-type-tools/psautohint and run tox-something?

@anthrotype
Copy link
Author

thanks for looking into this. Yes, you can just clone and run tox, you should get a warning like this
https://travis-ci.org/adobe-type-tools/psautohint/jobs/414896624#L498

@ionelmc
Copy link
Member

ionelmc commented Mar 25, 2019

Check the new examples from #267 - they should clarify how to correctly use pytest-cov in your project.

@ionelmc ionelmc closed this as completed Mar 25, 2019
@anthrotype
Copy link
Author

Thank you!

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

No branches or pull requests

2 participants