Already imported module
See original GitHub issueHey! I’m trying to migrate over my tests from nose to pytest to test my twisted application.
This site says:
If a plugin is installed, pytest automatically finds and integrates it, there is no need to activate it.
So according to this all I have to do is pip install pytest-twisted, but when I try running my tests I get:
AttributeError: 'module' object has no attribute 'inlineCallbacks'
So on this site it says to put the following into conftest.py:
pytest_plugins = "pytest_twisted"
So I make conftest.py
next to my testing Python file in the tests folder and get the following warning:
None
Module already imported so can not be re-written: pytest_twisted
-- Docs: http://doc.pytest.org/en/latest/warnings.html
It seems like it auto discovers the plugin, but doesn’t update itself with inlinecallback without reimporting it? Would this be a bug, or just me not understanding something properly?
Any help is appreciated! Thank you!
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Are you passing
--twisted
on the command line? I suggest to do that or add to thepytest.ini
file:Adding
pytest_plugins
to theconftest.py
only works if you add it to your rootconftest.py
file. Anyway I suggest adding topytest.ini
as this is the simplest option IMHO.Okay, thanks! I’ll bug them with my question.