path issues when running unit tests
I'm running into trouble when running tests from a directory which is under the project directory.
I have the following folder structure:
project
/lib1
/lib2
source1.py
source2.py
/tests
test_source1.py
so t=he test I'm trying to run is /project/lib2/tests/test_source1.py,
and it needs to import the module /project/lib2/source1.py
I've tried to set the interpreter working directory by going to:
Edit configurations –> Unittests in test_source1 –>Interperter –> Working directory, and setting it to: /project/lib2/ and then to /project, but still I'm unable to import source1.py in test_source1.py
Please advise,
Boaz
I have the following folder structure:
project
/lib1
/lib2
source1.py
source2.py
/tests
test_source1.py
so t=he test I'm trying to run is /project/lib2/tests/test_source1.py,
and it needs to import the module /project/lib2/source1.py
I've tried to set the interpreter working directory by going to:
Edit configurations –> Unittests in test_source1 –>Interperter –> Working directory, and setting it to: /project/lib2/ and then to /project, but still I'm unable to import source1.py in test_source1.py
Please advise,
Boaz
2 comments
Sort by
Date
Votes
If I understand your configuration correctly, you need to mark the lib1 and lib2 directories as source roots in Settings | Project Structure.
Thanks Dmitry - did the trick!
Please sign in to leave a comment.