Can't run tests AND script (import problems) #10627
-
Hello, I have the problem that my imports doesn't work when I try both testing and running. My project structure is like this: src/
- __init__.py
- main.py
- driver/
- __init__.py
- many stuff
tests/
- __init__.py
- test_main.py
To start my tests, I use the following command: # test_main.py
from src.driver import Driver
# main.py
from src.driver import Driver When I start my main.py script normally, then I need to change this # main.py
from driver import Driver Otherwise, I get the error:
All my |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Run your code as a Python module instead: |
Beta Was this translation helpful? Give feedback.
Run your code as a Python module instead:
python -m src.main