wemake-services / django-test-migrations

Test django schema and data migrations, including migrations' order and best practices.

Home Page:https://pypi.org/project/django-test-migrations/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support `pytest@7.0`

sobolevn opened this issue · comments

Right now it fails:

poetry run pytest --nomigrations --cov-fail-under=0
Traceback (most recent call last):
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/pytest_django/plugin.py", line 179, in _handle_import_error
    yield
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/pytest_django/plugin.py", line 351, in pytest_load_initial_conftests
    dj_settings.DATABASES
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/django/conf/__init__.py", line 79, in __getattr__
    self._setup(name)
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/django/conf/__init__.py", line 66, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/django/conf/__init__.py", line 157, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_test_app.settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/bin/pytest", line 8, in <module>
    sys.exit(console_main())
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/_pytest/config/__init__.py", line 188, in console_main
    code = main()
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/_pytest/config/__init__.py", line 146, in main
    config = _prepareconfig(args, plugins)
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/_pytest/config/__init__.py", line 325, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/pluggy/_callers.py", line 55, in _multicall
    gen.send(outcome)
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/_pytest/helpconfig.py", line 102, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1013, in pytest_cmdline_parse
    self.parse(args)
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1301, in parse
    self._preparse(args, addopts=addopts)
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1203, in _preparse
    self.hook.pytest_load_initial_conftests(
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
    return outcome.get_result()
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/pytest_django/plugin.py", line 350, in pytest_load_initial_conftests
    with _handle_import_error(_django_project_scan_outcome):
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/runner/work/django-test-migrations/django-test-migrations/.venv/lib/python3.10/site-packages/pytest_django/plugin.py", line 183, in _handle_import_error
    raise ImportError(msg)
ImportError: No module named 'django_test_app.settings'

pytest-django could not find a Django project (no manage.py file could be found). You must explicitly add your Django project to the Python path to have it picked up.
make: *** [Makefile:11: unit] Error 1

Link: https://github.com/wemake-services/django-test-migrations/runs/5087399817?check_suite_focus=true