'Error while loading the pytest module in Django project
I am trying to run pytest in a django project with it is showing me error of no module loading. I have created init.py in test folders, but that also not worked for me to resolve this issue.
______________ ERROR collecting lib/python3.9/site-packages/tenacity/tests/test_tornado.py _______________
ImportError while importing test module '/Users/xxxx/Documents/ecommerce/lib/python3.9/site-packages/tenacity/tests/test_tornado.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/homebrew/Cellar/[email protected]/3.9.12_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
lib/python3.9/site-packages/tenacity/tests/test_tornado.py:19: in <module>
from tenacity import tornadoweb
lib/python3.9/site-packages/tenacity/tornadoweb.py:23: in <module>
from tornado import gen
E ModuleNotFoundError: No module named 'tornado'
File Tree is as follows:
ecommerce
┣ __pycache__
┃ ┣ __init__.cpython-39.pyc
┃ ┣ settings.cpython-39.pyc
┃ ┣ urls.cpython-39.pyc
┃ ┗ wsgi.cpython-39.pyc
┣ dashboard
┃ ┣ __pycache__
┃ ┃ ┗ __init__.cpython-39.pyc
┃ ┣ migrations
┃ ┃ ┗ __init__.py
┃ ┣ tests
┃ ┃ ┣ __pycache__
┃ ┃ ┃ ┣ __init__.cpython-39.pyc
┃ ┃ ┃ ┗ test_selenium_dashboard.cpython-39-pytest-6.2.5.pyc
┃ ┃ ┣ __init__.py
┃ ┃ ┗ test_selenium_dashboard.py
┃ ┣ __init__.py
┃ ┣ admin.py
┃ ┣ apps.py
┃ ┣ models.py
┃ ┗ views.py
┣ tests
┃ ┣ __pycache__
┃ ┃ ┣ __init__.cpython-39.pyc
┃ ┃ ┣ selenium.cpython-39-pytest-6.2.5.pyc
┃ ┃ ┗ test_selenium.cpython-39-pytest-6.2.5.pyc
┃ ┣ __init__.py
┃ ┗ test_selenium.py
┣ .DS_Store
┣ __init__.py
┣ asgi.py
┣ settings.py
┣ urls.py
┗ wsgi.py
conftest.py
db.sqlite3
manage.py
pytest.ini
pyvenv.cfg
requirement.text
chrome driver
Extract of conftest.py is as follows:
pytest_plugins = [
"ecommerce.tests.test_selenium"
]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|