1
I’m looking to test simple python code using pytest. My hierarchy is as follows::
PythonExamples
files
mymath.py
tests
test_mymath.py
in test_mymath.py, I import mymath as
from ..files import mymath as mm
def test_mysum():
assert mm.mysum(2,3) == 5
In the Pythonexamples folder I run the py.test tests command, but I get the following message:
Parent module '' not Loaded, cannot perform relative import
What can it be?
try:
from ..files.mymath import mysum
, in the case ofmysum
would be thedef
which is created within themymath.py
– brow-joe