So you are running py.test
from /App
. Are you sure /App/App
is in your $PYTHONPATH
?
If it's not, code that tries to import app
will fail with such a message.
EDIT0: including the info from my comment below, for completeness.
An attempt to import app will only succeed if it was executed inside /App/App
, which is not the case here. You probably want to make /App/App
a package by putting __init__.py
inside it, and change your import to qualify app as from App import app
.
EDIT1: by request, adding further explanation from my second comment below.
By putting __init__.py
inside /App/App
, that directory becomes a package. Which means you can import from it, as long as it - the directory - is visible in the $PYTHONPATH
. I.e. you can do from App import app
if /App
is in the $PYTHONPATH
. Your current working directory gets automatically added to $PYTHONPATH
, so when you run a script from /App
, the import will work.
--cache-clear
pytest
flag to solved the error. The problem happends to me when I modify import statements on a class that I was testing. At this point in time I do not know the exact reason about this. – Quintilla