Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: module incorrectly imported

I am getting error when I run below given command

docker-compose run app python manage.py test

ImportError: 'tests' module incorrectly imported from '/app/core/tests'. Expected '/app/core'. Is this module globally installed?

Tried to import that from shell but still not working

>>> import app.core.tests
Traceback (most recent call last):
  File "<console>", line 1, in <module>

ModuleNotFoundError: No module named 'app.core'

Versions:


Django==2.1.3
djangorestframework==3.9.0
docker==3.7.2
docker-compose==1.24.0
docker-pycreds==0.4.0
dockerpty==0.4.1
docopt==0.6.2

Python 3.7.2

enter image description here

like image 337
Hardik Patel Avatar asked Jun 04 '26 18:06

Hardik Patel


1 Answers

As you want to use the tests folder instead of the tests.py file, you need to delete the latter so that they don't conflict. That way they should work.

like image 198
gildniy Avatar answered Jun 07 '26 08:06

gildniy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!