question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Module already imported warning

See original GitHub issue

When 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:open
  • Created 7 years ago
  • Reactions:12
  • Comments:20 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
blueyedcommented, Sep 21, 2018
2reactions
ucyocommented, Jul 5, 2017

I’m getting the same error, if I use pytest-xdist and the --looponfail option

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found