pytest no django "lazy_django.py no Django settings"

Viewed 527

my project list:

main_project
 - tests/
 - main_project
  - project1/
  - django_project/
   - tests/
   - django_app/
   - django_project/
    - manage.py

now, when I on main_project path, run pytest ./projects/django_project, it can pass django_project pytest.

But I want run one pytest to run wholl pytest including project1 & django_project on main_project path, it passed all project1 pytests, but auto skipped django_project's pytest, when I run with pytest -rsx it shows:

SKIPPED [2] .../local/lib/python3.6/site-packages/pytest-django/lazy_django.py:14: no Django settings

Any suggestion? thanks!

1 Answers

This error means pytest-django can't find your django settings. I had this same error and fixed it by adding a pytest.ini file and pointing to my django settings module:

[pytest]
DJANGO_SETTINGS_MODULE = my_app.settings
Related