Bug 2424593 - python-pytest-django fails to build with Python 3.15: AttributeError: 'ConfigurationLoader' object has no attribute 'exec_module'. Did you mean: 'load_module'?
Summary: python-pytest-django fails to build with Python 3.15: AttributeError: 'Config...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: python-pytest-django
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Michel Lind
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.15
TreeView+ depends on / blocked
 
Reported: 2025-12-23 13:49 UTC by Karolina Surma
Modified: 2025-12-23 13:49 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2025-12-23 13:49:25 UTC
python-pytest-django fails to build with Python 3.15.0a3.

4 tests fail with similar traceback:

________________________________ test_dc_option ________________________________

pytester = <Pytester PosixPath('/tmp/pytest-of-mockbuild/pytest-0/test_dc_option0')>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fc09704b0e0>

    def test_dc_option(pytester: pytest.Pytester, monkeypatch: pytest.MonkeyPatch) -> None:
        monkeypatch.setenv("DJANGO_SETTINGS_MODULE", "DO_NOT_USE_env")
        monkeypatch.setenv("DJANGO_CONFIGURATION", "DO_NOT_USE_env")
    
        pytester.makeini(
            """
           [pytest]
           DJANGO_SETTINGS_MODULE = DO_NOT_USE_ini
           DJANGO_CONFIGURATION = DO_NOT_USE_ini
        """
        )
        pkg = pytester.mkpydir("tpkg")
        settings = pkg.joinpath("settings_opt.py")
        settings.write_text(BARE_SETTINGS)
        pytester.makepyfile(
            """
            import os
    
            def test_ds():
                assert os.environ['DJANGO_SETTINGS_MODULE'] == 'tpkg.settings_opt'
                assert os.environ['DJANGO_CONFIGURATION'] == 'MySettings'
        """
        )
        result = pytester.runpytest_subprocess("--ds=tpkg.settings_opt", "--dc=MySettings")
>       result.stdout.fnmatch_lines(
            [
                "django: version: *, settings: tpkg.settings_opt (from option),"
                " configuration: MySettings (from option)",
                "* 1 passed*",
            ]
        )
E       Failed: remains unmatched: 'django: version: *, settings: tpkg.settings_opt (from option), configuration: MySettings (from option)'

/builddir/build/BUILD/python-pytest-django-4.9.0-build/pytest_django-4.9.0/tests/test_django_configurations.py:146: Failed
----------------------------- Captured stdout call -----------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-mockbuild/pytest-0/test_dc_option0/runpytest-0 --ds=tpkg.settings_opt --dc=MySettings
     in: /tmp/pytest-of-mockbuild/pytest-0/test_dc_option0
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
  File "<frozen runpy>", line 196, in _run_module_as_main
  File "<frozen runpy>", line 87, in _run_code
  File "/usr/lib/python3.15/site-packages/pytest/__main__.py", line 9, in <module>
    raise SystemExit(pytest.console_main())
                     ~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.15/site-packages/_pytest/config/__init__.py", line 201, in console_main
    code = main()
  File "/usr/lib/python3.15/site-packages/_pytest/config/__init__.py", line 156, in main
    config = _prepareconfig(args, plugins)
  File "/usr/lib/python3.15/site-packages/_pytest/config/__init__.py", line 342, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
        pluginmanager=pluginmanager, args=args
    )
  File "/usr/lib/python3.15/site-packages/pluggy/_hooks.py", line 512, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.15/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.15/site-packages/pluggy/_callers.py", line 167, in _multicall
    raise exception
  File "/usr/lib/python3.15/site-packages/pluggy/_callers.py", line 139, in _multicall
    teardown.throw(exception)
    ~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/usr/lib/python3.15/site-packages/_pytest/helpconfig.py", line 112, in pytest_cmdline_parse
    config = yield
             ^^^^^
  File "/usr/lib/python3.15/site-packages/pluggy/_callers.py", line 121, in _multicall
    res = hook_impl.function(*args)
  File "/usr/lib/python3.15/site-packages/_pytest/config/__init__.py", line 1146, in pytest_cmdline_parse
    self.parse(args)
    ~~~~~~~~~~^^^^^^
  File "/usr/lib/python3.15/site-packages/_pytest/config/__init__.py", line 1527, in parse
    self._preparse(args, addopts=addopts)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.15/site-packages/_pytest/config/__init__.py", line 1431, in _preparse
    self.hook.pytest_load_initial_conftests(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        early_config=self, args=args, parser=self._parser
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.15/site-packages/pluggy/_hooks.py", line 512, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.15/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.15/site-packages/pluggy/_callers.py", line 167, in _multicall
    raise exception
  File "/usr/lib/python3.15/site-packages/pluggy/_callers.py", line 139, in _multicall
    teardown.throw(exception)
    ~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/usr/lib/python3.15/site-packages/_pytest/warnings.py", line 129, in pytest_load_initial_conftests
    return (yield)
            ^^^^^
  File "/usr/lib/python3.15/site-packages/pluggy/_callers.py", line 139, in _multicall
    teardown.throw(exception)
    ~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/usr/lib/python3.15/site-packages/_pytest/capture.py", line 173, in pytest_load_initial_conftests
    yield
  File "/usr/lib/python3.15/site-packages/pluggy/_callers.py", line 121, in _multicall
    res = hook_impl.function(*args)
  File "/builddir/build/BUILD/python-pytest-django-4.9.0-build/BUILDROOT/usr/lib/python3.15/site-packages/pytest_django/plugin.py", line 357, in pytest_load_initial_conftests
    dj_settings.DATABASES  # noqa: B018
    ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.15/site-packages/django/conf/__init__.py", line 81, in __getattr__
    self._setup(name)
    ~~~~~~~~~~~^^^^^^
  File "/usr/lib/python3.15/site-packages/django/conf/__init__.py", line 68, in _setup
    self._wrapped = Settings(settings_module)
                    ~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.15/site-packages/django/conf/__init__.py", line 166, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib64/python3.15/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1303, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1276, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1247, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 857, in _load_unlocked
AttributeError: 'ConfigurationLoader' object has no attribute 'exec_module'. Did you mean: 'load_module'?

https://docs.python.org/3.15/whatsnew/3.15.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.15/fedora-rawhide-x86_64/09935391-python-pytest-django/

For all our attempts to build python-pytest-django with Python 3.15, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.15/package/python-pytest-django/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.15:
https://copr.fedorainfracloud.org/coprs/g/python/python3.15/

Let us know here if you have any questions.

Python 3.15 is planned to be included in Fedora 45.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.15.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.


Note You need to log in before you can comment on or make changes to this bug.