Skip to content Skip to sidebar Skip to footer

Py.test Does Not Correctly Import Modules From Conftest - Fails With Conftestimportfailure: Modulenotfound

pytest fails to import modules even though these modules import fine under the vanilla python interpreter. Especially modules imported from conftest fails to resolve. ImportErrori

Solution 1:

pytest may be picky if you have __init__.py files under your tests folder and subfolders. This may cause pytest to resolve Python modules in incorrect order under certain circumstances.

The workaround is to remove all __init__.py files under tests.

Post a Comment for "Py.test Does Not Correctly Import Modules From Conftest - Fails With Conftestimportfailure: Modulenotfound"