today's error
pytest 오류모음
Algorithm90
2019. 6. 30. 19:34
django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
해결방법
$ export DJANGO_SETTINGS_MODULE='config.settings' <-- 터미널에 명령어 입력
혹은프로젝트 root directory에 pytest.ini 라는 파일을 만들고
[pytest]
DJANGO_SETTINGS_MODULE = yourproject.settings 입력
python_files = tests.py test_*.py *_tests.py(테스트파일 못찾을때 같이 입력)
Anonymous, mixer같은 모듈을 불러오지 못함
해결방법
$ pip install pytest-django (django-pytest 가 아님에 주의)
db를 못찾음
해결방법
해당 함수에 데코레이터 삽입 @pytest.mark.django_db