Module already imported warning
See original GitHub issueWhen I run my tests using pytest==3.0.6
and pytest-cov==2.4.0
, I see the following warning:
======================= pytest-warning summary ======================
WP1 None Module already imported so can not be re-written: pytest_cov
============ 1 passed, 1 pytest-warnings in 0.09 seconds ============
which unfortunately causes pytest to return a non-zero exit code and make the test suite as failing.
I don’t see this warning with pytest==2.9.2
.
If it helps, I found a similar issue reported in another library: https://github.com/philpep/testinfra/issues/125
Issue Analytics
- State:
- Created 7 years ago
- Reactions:12
- Comments:20 (12 by maintainers)
Top Results From Across the Web
PytestWarning: Module already imported so cannot be rewritten
It seems that you are invoking pytest with ipython or jupyter. python.main imports pytest specific modules at the time of pytest initialization.
Read more >pytest.PytestAssertRewriteWarning: Module already imported ...
Config object at 0x7ff7857c78e0> warning = PytestAssertRewriteWarning('Module already imported so cannot be rewritten: pytest_doctestplus') ...
Read more >5. The import system — Python 3.11.1 documentation
When a module is first imported, Python searches for the module and if found, ... For example, assuming none of the modules involved...
Read more >"Unused import" warning for module ... - JetBrains YouTrack
"Unused import" warning for module.module imports when importing two modules from the same package. ... When importing multiple submodules and referencing the ...
Read more >Python import: Advanced Techniques and Tips
How does Python find the modules and packages it imports? You'll see more details about the mechanics of the Python import system later....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Found a workaround: https://github.com/pytest-dev/pytest-cov/pull/228
I’m getting the same error, if I use pytest-xdist and the
--looponfail
option