****solved: added __init__.py
to Test/
and renamed testcode.py
to test_code.py
. To run tests cd -> Zee
and type pytest
****
Structure:
|--Zee/
| |--Test/
| | |--__init__.py
| | |--test_code.py
| |--Codetotest/
| | |--code.py
in code.py
class Foo():
some code...
in testcode.py
from Codetotest.code import Foo
def test_foo():
assert ...
When I move to the Zee
directory in my command line and run pytest Test/testcode.py
I get ModuleNotFoundError: No module named Zee
. How can I fix this?
I tried making Test a module by adding Test/__init__.py
as suggested here. Ran from multiple directories, no dice.
Pytest version 5.3.4, imported from python 3.6
What I don't understand is, when I add __init__.py
to Zee/
, it gives me the same error