I'm unable to import my module for testing in the way that I'd like. I'm running all of this in a virtualenv on 2.7.2
I have a directory structure like
/api
/api
__init__.py
my_module.py
/tests
my_module_test.py
I have my PYTHONPATH set to /Path/api/. I CD into /Path/api and run the following
py.test tests/my_module_test.py
It does not work in the following case:
from api.my_module import my_function
It does work in the following case:
from my_module import my_function
Why am I not able to import my module as in case 1?
I use PYTHONPATH as
PYTHONPATH=`pwd` py.test tests/my_module_test.py
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With