Closed
Description
Pytest doesn't seem to work with implicit namespaces in your source, as defined by PEP 420. This still occurs as of pytest 5.0.1 installed in a Python 3 environment.
Note this is for the source package being tested, and I've encountered the issue with tests outside of the source package (init.py files are required for tests as noted in the best practices document.
E.g.
mypkg/
foo/
baz.py
bar/
baz.py
tests/
will yield errors like
./../../.local/lib/python3.6/site-packages/py/_path/local.py:721: in pyimport
raise self.ImportMismatchError(modname, modfile, self)
E py._path.local.LocalPath.ImportMismatchError: ('baz', '/home/vsts/work/1/s/mkpkg/foo/baz.py', local('/home/vsts/work/1/s/mkpkg/bar/mkpkg.py'))
This issue has appeared in #774.