You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure what is the root cause of the issue, pytest debug in Python 3.11 works fine.
So I try to run the test as usual in debug mode via PyCharm, but get error django.core.exceptions.ImproperlyConfigured. Even if I supply DJANGO_SETTINGS_MODULE env variable manually, I get next errors and I guess it is wrong direction for fixing the issue.
/Users/user_x/Python/VirtualEnv/soc-backend-312/bin/python -X pycache_prefix=/Users/user_x/Library/Caches/JetBrains/PyCharm2023.3/cpython-cache /Users/user_x/Applications/PyCharm Professional.app/Contents/plugins/python/helpers/pydev/pydevd.py --multiprocess --save-signatures --qt-support=auto --client 127.0.0.1 --port 52154 --file /Users/user_x/Applications/PyCharm Professional.app/Contents/plugins/python/helpers/pycharm/_jb_pytest_runner.py --target soc/tests/e2e/test_enrollment.py::test_enrollment_studies_count_by_status
Testing started at 15:26 ...
Connected to pydev debugger (build 233.14475.56)
Launching pytest with arguments soc/tests/e2e/test_enrollment.py::test_enrollment_studies_count_by_status --no-header --no-summary -q in /Users/user_x/Python/Projects/soc-backend
Traceback (most recent call last):
File "/Users/user_x/Applications/PyCharm Professional.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1534, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user_x/Applications/PyCharm Professional.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/user_x/Applications/PyCharm Professional.app/Contents/plugins/python/helpers/pycharm/_jb_pytest_runner.py", line 60, in <module>
sys.exit(pytest.main(args, plugins_to_load + [Plugin]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/_pytest/config/__init__.py", line 156, in main
config = _prepareconfig(args, plugins)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/_pytest/config/__init__.py", line 338, in _prepareconfig
config = pluginmanager.hook.pytest_cmdline_parse(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/pluggy/_hooks.py", line 501, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/pluggy/_manager.py", line 119, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/pluggy/_callers.py", line 138, in _multicall
raise exception.with_traceback(exception.__traceback__)
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/pluggy/_callers.py", line 121, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/_pytest/helpconfig.py", line 105, in pytest_cmdline_parse
config = yield
^^^^^
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/pluggy/_callers.py", line 102, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1096, in pytest_cmdline_parse
self.parse(args)
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1449, in parse
self._preparse(args, addopts=addopts)
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1326, in _preparse
self.pluginmanager.load_setuptools_entrypoints("pytest11")
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/pluggy/_manager.py", line 414, in load_setuptools_entrypoints
plugin = ep.load()
^^^^^^^^^
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
module = import_module(match.group('module'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
exec(co, module.__dict__)
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/pytest_factoryboy/__init__.py", line 2, in <module>
from .fixture import LazyFixture, named_model, register
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
exec(co, module.__dict__)
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/pytest_factoryboy/fixture.py", line 26, in <module>
import factory
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/factory/__init__.py", line 60, in <module>
from . import django
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/factory/django.py", line 13, in <module>
from django.contrib.auth.hashers import make_password
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/django/contrib/auth/__init__.py", line 7, in <module>
from django.middleware.csrf import rotate_token
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/django/middleware/csrf.py", line 14, in <module>
from django.http import HttpHeaders, UnreadablePostError
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/django/http/__init__.py", line 9, in <module>
from django.http.response import (
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/django/http/response.py", line 19, in <module>
from django.core.serializers.json import DjangoJSONEncoder
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/django/core/serializers/__init__.py", line 23, in <module>
from django.core.serializers.base import SerializerDoesNotExist
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/django/core/serializers/base.py", line 9, in <module>
from django.db import models
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/django/db/__init__.py", line 50, in <module>
signals.request_started.connect(reset_queries)
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/django/dispatch/dispatcher.py", line 83, in connect
if settings.configured and settings.DEBUG:
^^^^^^^^^^^^^^^^^^^
File "_pydevd_bundle/pydevd_pep_669_tracing_cython.pyx", line 504, in _pydevd_bundle.pydevd_pep_669_tracing_cython.PyRaiseCallback.__call__
File "_pydevd_bundle/pydevd_pep_669_tracing_cython.pyx", line 47, in _pydevd_bundle.pydevd_pep_669_tracing_cython.PEP669CallbackBase.frame
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/django/utils/functional.py", line 295, in __getattribute__
value = super().__getattribute__(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/django/utils/functional.py", line 266, in inner
self._setup()
File "/Users/user_x/Python/VirtualEnv/soc-backend-312/lib/python3.12/site-packages/django/conf/__init__.py", line 82, in _setup
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Requested settings, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Process finished with exit code 1
Empty suite
Empty suite
python 3.12.2
pytest 8.0.2 (checked also with pytest 7)
pytest-django 4.8.0
pytest-factoryboy 2.6.0
The text was updated successfully, but these errors were encountered:
Not sure what is the root cause of the issue, pytest debug in Python 3.11 works fine.
So I try to run the test as usual in debug mode via PyCharm, but get error
django.core.exceptions.ImproperlyConfigured
. Even if I supplyDJANGO_SETTINGS_MODULE
env variable manually, I get next errors and I guess it is wrong direction for fixing the issue.python 3.12.2
pytest 8.0.2 (checked also with pytest 7)
pytest-django 4.8.0
pytest-factoryboy 2.6.0
The text was updated successfully, but these errors were encountered: