Cannot configure pytest in my simple project
Question:
i have the folowing project structure, but when trying to run pytest in console i get error.
Is the problem in pytest.ini?
ERROR backend/tests/test_user.py - django.core.exceptions.ImproperlyConfigured: Requested setting REST_FRAMEWORK, but settings are not configured. You must either define the environment variable
DJANGO_SETTINGS_MODULE or call
backend
|-foodgram
|-foodgram
|-manage.py
|-api
|-users
|-tests
|-pytest.ini
in my pytest.ini
[pytest]
python_paths = foodgram/
DJANGO_SETTINGS_MODULE = foodgram.settings
norecursedirs = env/*
addopts = -vv -p no:cacheprovider
testpaths = tests/
python_files = test_*.py
Answers:
installed additional packages
pytest-pythonpath
i have the folowing project structure, but when trying to run pytest in console i get error.
Is the problem in pytest.ini?
ERROR backend/tests/test_user.py - django.core.exceptions.ImproperlyConfigured: Requested setting REST_FRAMEWORK, but settings are not configured. You must either define the environment variable
DJANGO_SETTINGS_MODULE or call
backend
|-foodgram
|-foodgram
|-manage.py
|-api
|-users
|-tests
|-pytest.ini
in my pytest.ini
[pytest]
python_paths = foodgram/
DJANGO_SETTINGS_MODULE = foodgram.settings
norecursedirs = env/*
addopts = -vv -p no:cacheprovider
testpaths = tests/
python_files = test_*.py
installed additional packages
pytest-pythonpath