Hint: make sure your test modules/packages have valid Python names. Pytest error
_____________________________________________________________________________________ ERROR collecting test_panda_1.py ______________________________________________________________________________________
ImportError while importing test module
'D:\pythonhome\pandabus_API_test_pytest\case\test_panda_1.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: test_panda_1.py:7: in <module> from common.logger import log E ModuleNotFoundError: No module named 'common
Solution:
Method 1: Create a new conftest.py file in the root directory where you want to execute pytest; the contents of the file
import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '. ')))
Method 2: pyteset contains __init__.py files in each directory under the test case directory; execute it in the project’s follow directory, which is also possible, as tested
Read More:
- ModuleNotFoundError: No module named ‘requests‘ [How to Solve]
- [Solved] ModuleNotFoundError: No module named ‘requests‘
- Pytest AttributeError: module ‘pytest‘ has no attribute ‘main‘
- [Solved] ModuleNotFoundError: No module named ‘xxx’; ‘xxx’ is not a package
- [Solved] ModuleNotFoundError: No module named ‘_polyiou‘
- [Solved] ByteTrack Error: ModuleNotFoundError: No module named ‘yolox’
- How to Solve PyInstaller Package Error: ModuleNotFoundError: No module named ‘xxxx‘
- ModuleNotFoundError: No module named ‘tensorflow.python’ And the pits encountered after installation
- [Solved] ModuleNotFoundError: No module named ‘pip‘
- ModuleNotFoundError: no module named ‘pip‘ [How to Solve]
- [Solved] Pychar error: modulenotfounderror: no module named ‘requests_ HTML ‘solution
- [Solved] scikit-learn Error: ModuleNotFoundError: No module named ‘sklearn.utils.linear_assignment_’
- [Solved] modulenotfounderror: no module named ‘torchtext.legacy.data.datasets_ utils‘
- [Solved] jupyter notebook Error: ModuleNotFoundError: No module named jupyter_nbextensions_configurator
- [Solved] Jupyter notebook use pyLDAvis Error: modulenotfounderror: no module named ‘pyLDAvis’‘
- [Mac M1] How to Solve import wordcloud Error: ModuleNotFoundError: No module named ‘wordcloud‘
- Module not found error: no module named ‘filefolder’ appears when learning engineering knowledge
- Module notfounderror when installing suds: no module named ‘client’ solution
- pytest pluggy.manager.PluginValidationError: unknown hook’pytest_namespace’ error handling method
- [How to Solve] ImportError: No module named typing