AttributeError: 'module' object has no attribute 'tests'

后端 未结 11 1800
自闭症患者
自闭症患者 2020-12-04 14:43

I\'m running this command:

python manage.py test project.apps.app1.tests

and it causes this error:

AttributeError: \

11条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-04 15:26

    Steve Bradshaw's example above works for import errors (thanks Steve).

    Other type of errors (e.g. ValueError) may also cause

    AttributeError: 'module' object has no attribute 'tests'
    

    to see what these errors are

    ./manage.py shell
    from myapp.tests import SomeTestCase
    t = SomeTestCase()
    

提交回复
热议问题