Reputation: 330
I have this file structure.
When ı wrote pytest in my terminal.
ı have this issue !
ModuleNotFoundError: No module named 'money_transactions_test'
Hint: make sure your test modules/packages have valid Python names.
Why its can't import money_transactions_test ?
Upvotes: 7
Views: 37234
Reputation: 11
Try creating a file "pytest.ini" and adding the following entry:
[pytest] pythonpath = . test
Upvotes: 1
Reputation: 2159
If you're sharing objects within your tests the easiest thing would be to make use of conftest.py
However if you must import, since your test files are in the same package directory I recommend specifying a relative import. ie:
from .money_transactions_test import acc_numbers_list
Upvotes: 2