Chameleon
Chameleon

Reputation: 10138

How to disable adding relative path in PyCharm?

I want to execute tests but I can not since PyCharm is adding relative path of file executed.

I have such directory structure:

src
src/wage.py
src/test/__init__.py
src/test/wage.py

When I put src/test/wage.py it imports src/test/wage.py instead src/wage.py since sys.path is ['src/test', 'src'] not ['src'].

How to disable adding src/test at all or at first place in PyCharm - since it impossible to import correct wage.py?

Upvotes: 1

Views: 351

Answers (1)

Mensur
Mensur

Reputation: 1096

In PyCharm: Run -> Edit Configurations

Under Configurations tab you change the "Working directory" from src/test/ to src

Upvotes: 3

Related Questions