1
votes

I have a project with the following structure

 -project
 --src
 --test

when i run pytest inside project folder from python2 (python2 -m pytest), it works fine, however, with python 3 (python3 -m pytest), i have an error in the test files as it cant find the imports in the src folder

I have an __init__.py in both folders

Is there any reason why it should be different in python2 and python3? How could i make it work in python3?

Thanks

1
did you install pytest using pip? - Joshua Yonathan
yes, its how i usually instal packages - test test

1 Answers

0
votes

You have not provided details about exact import error, but probably you are using relative imports, which behaves differently in Python 2 and 3. If that's the case, try to use absolute imports.