Description
I am trying to add a pytest plugin to coverage.py. Because the plugin is in the coverage package, coverage/init.py will be imported when the plugin is imported. Because I'm using coverage to run pytest in the first place, coverage/__init__.py
has already been imported. This leads to a warning:
PytestAssertRewriteWarning: Module already imported so cannot be rewritten: coverage
I can disable this warning by adding PYTEST_DONT_REWRITE to the coverage/__init__.py
docstring, but then that word is visible in the docstring for my package. Ugly.
Much of pytest is controlled by specially named attributes in modules. It would be great if I could control rewriting by adding an attribute to my module instead of amending the docstring.
If needed, I can provide a reproducer that shows the warning.