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
PytestAssertRewriteWarning when including a plugin via 'pytest_plugins' and importing #11150
Comments
See the relevant docs:
|
This is not working with pytest_jsonreport: import pytest
pytest.register_assert_rewrite('pytest_jsonreport', 'JSONReport', 'json_report_plugin') # Source: https://github.com/pytest-dev/pytest/issues/11150; call before importing pytest_jsonreport
from pytest_jsonreport.plugin import JSONReport
pytest.register_assert_rewrite('pytest_jsonreport', 'JSONReport', 'json_report_plugin') # Source: https://github.com/pytest-dev/pytest/issues/11150; call before importing pytest_jsonreport Any suggestions what I'm doing wrong? @The-Compiler |
@DeflateAwning Sorry, this got lost in my inbox. You should probably call If it's not that, make sure it really didn't get imported before, e.g. via |
Weird, still didn't work |
Warning when running pytest:
PytestAssertRewriteWarning: Module already imported so cannot be rewritten: plugin
Steps to reproduce
plugin.py
file.pytest_plugins
and also imports the plugin:Extra information
Obviously this is a contrived minimal example; a more realistic scenario is:
conftest.py
containspytest_plugins = (...)
This is not seen when loading the plugin using
pytest -p plugin
instead (since the import happens earlier?).Perhaps related to #10230?
The text was updated successfully, but these errors were encountered: