Bug 2351383 - poetry fails to build with Python 3.14: AssertionError in test_isolated_env_install_discards_requirements_not_needed_by_env and test_python_get_preferred_default
Summary: poetry fails to build with Python 3.14: AssertionError in test_isolated_env_i...
Keywords:
Status: POST
Alias: None
Product: Fedora
Classification: Fedora
Component: poetry
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tomáš Hrnčiar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2025-03-11 15:10 UTC by Karolina Surma
Modified: 2025-05-28 12:10 UTC (History)
4 users (show)

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


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github python-poetry poetry issues 10302 0 None open test_python_get_preferred_default doesn't work on pre-releases 2025-03-26 12:05:32 UTC
Github python-poetry poetry issues 10306 0 None open test_isolated_env_install_discards_requirements_not_needed_by_env fails with python 3.14.0a6 2025-03-27 08:15:50 UTC
Github python-poetry poetry pull 10303 0 None open Fix test_python_get_preferred_default with Python pre-releases 2025-03-26 13:58:39 UTC

Description Karolina Surma 2025-03-11 15:10:56 UTC
poetry fails to build with Python 3.14.0a5.

______ test_isolated_env_install_discards_requirements_not_needed_by_env _______
[gw3] linux -- Python 3.14.0 /usr/bin/python3

pool = <poetry.repositories.repository_pool.RepositoryPool object at 0x7f7978d37ef0>

    def test_isolated_env_install_discards_requirements_not_needed_by_env(
        pool: RepositoryPool,
    ) -> None:
        with ephemeral_environment(Path(sys.executable)) as venv:
            env = IsolatedEnv(venv, pool)
            assert not InstalledRepository.load(venv).find_packages(
                get_dependency("poetry-core")
            )
    
            venv_python_version = venv.get_marker_env().get("python_version")
            package_one = uuid.uuid4().hex
            package_two = uuid.uuid4().hex
    
            env.install(
                {
                    f"poetry-core; python_version=='{venv_python_version}'",
                    f"{package_one}>=1.0.0; python_version=='0.0'",
                    f"{package_two}>=2.0.0; platform_system=='Mirrors'",
                }
            )
>           assert InstalledRepository.load(venv).find_packages(
                get_dependency("poetry-core")
            )
E           assert []
E            +  where [] = find_packages(<Dependency poetry-core>)
E            +    where find_packages = <poetry.repositories.installed_repository.InstalledRepository object at 0x7f79797104d0>.find_packages
E            +      where <poetry.repositories.installed_repository.InstalledRepository object at 0x7f79797104d0> = load(VirtualEnv("/tmp/tmpp_tpbjyt/.venv"))
E            +        where load = InstalledRepository.load
E            +    and   <Dependency poetry-core> = get_dependency('poetry-core')

/builddir/build/BUILD/poetry-2.1.1-build/poetry-2.1.1/tests/utils/test_isolated_build.py:80: AssertionError
------------------------------ Captured log call -------------------------------
INFO     virtualenv.discovery.builtin:builtin.py:76 find interpreter for spec PythonSpec(path=/usr/bin/python3)
INFO     virtualenv.discovery.builtin:builtin.py:83 proposed PythonInfo(spec=CPython3.14.0.alpha.5-64, exe=/usr/bin/python3.14, platform=linux, version='3.14.0a5 (main, Feb 12 2025, 00:00:00) [GCC 15.0.1 20250204 (Red Hat 15.0.1-0)]', encoding_fs_io=utf-8-utf-8)
INFO     virtualenv.run.session:session.py:52 create virtual environment via CPython3Posix(dest=/tmp/tmpp_tpbjyt/.venv, clear=False, no_vcs_ignore=False, global=False)
INFO     virtualenv.run.session:session.py:65 add activators for Bash, CShell, Fish, Nushell, PowerShell, Python
DEBUG    httpretty.core:core.py:588 setsockopt(6, 1, 1) failed
DEBUG    httpretty.core:core.py:458 error closing file <httpretty.core.FakeSockFile object at 0x7f79789df0e0>: 'super' object has no attribute 'flush'
INFO     httpretty.core:core.py:1629 captured: <HTTPrettyRequest("GET", "https://pypi.org/simple/poetry-core/", headers={'Host': 'pypi.org', 'User-Agent': 'poetry/2.1.1 CPython/3.14.0a5 Linux/6.11.8-300.fc41.x86_64', 'Accept-Encoding': 'gzip, deflate, zstd', 'Accept': 'application/vnd.pypi.simple.v1+json', 'Connection': 'keep-alive'}, body=0)>
DEBUG    httpretty.core:core.py:458 error closing file <httpretty.core.FakeSockFile object at 0x7f79789dee40>: 'super' object has no attribute 'flush'
DEBUG    httpretty.core:core.py:588 setsockopt(6, 1, 1) failed
DEBUG    httpretty.core:core.py:458 error closing file <httpretty.core.FakeSockFile object at 0x7f7978d50a60>: 'super' object has no attribute 'flush'
INFO     httpretty.core:core.py:1629 captured: <HTTPrettyRequest("GET", "https://pypi.org/pypi/poetry-core/2.0.1/json", headers={'Host': 'pypi.org', 'User-Agent': 'poetry/2.1.1 CPython/3.14.0a5 Linux/6.11.8-300.fc41.x86_64', 'Accept-Encoding': 'gzip, deflate, zstd', 'Accept': '*/*', 'Connection': 'keep-alive'}, body=0)>
DEBUG    httpretty.core:core.py:458 error closing file <httpretty.core.FakeSockFile object at 0x7f7978bb7150>: 'super' object has no attribute 'flush'
______________________ test_python_get_preferred_default _______________________
[gw3] linux -- Python 3.14.0 /usr/bin/python3

config = <tests.conftest.Config object at 0x7f7978b78910>

    def test_python_get_preferred_default(config: Config) -> None:
        python = Python.get_preferred_python(config)
    
        assert python.executable.resolve() == Path(sys.executable).resolve()
>       assert python.version == Version.parse(
            ".".join(str(v) for v in sys.version_info[:3])
        )
E       AssertionError: assert Version(epoch=0, release=Release(major=3, minor=14, patch=0, extra=(), precision=3, text='3.14.0', _compare_key=(3, 14...3, 14)), ReleaseTag(phase='a', number=5), ReleaseTag(phase='', number=0), ReleaseTag(phase='z', number=0), ((0, ''),))) == Version(epoch=0, release=Release(major=3, minor=14, patch=0, extra=(), precision=3, text='3.14.0', _compare_key=(3, 14...3, 14)), ReleaseTag(phase='z', number=0), ReleaseTag(phase='', number=0), ReleaseTag(phase='z', number=0), ((0, ''),)))
E        +  where Version(epoch=0, release=Release(major=3, minor=14, patch=0, extra=(), precision=3, text='3.14.0', _compare_key=(3, 14...3, 14)), ReleaseTag(phase='a', number=5), ReleaseTag(phase='', number=0), ReleaseTag(phase='z', number=0), ((0, ''),))) = <poetry.utils.env.python.manager.Python object at 0x7f7978e0ca50>.version
E        +  and   Version(epoch=0, release=Release(major=3, minor=14, patch=0, extra=(), precision=3, text='3.14.0', _compare_key=(3, 14...3, 14)), ReleaseTag(phase='z', number=0), ReleaseTag(phase='', number=0), ReleaseTag(phase='z', number=0), ((0, ''),))) = parse('3.14.0')
E        +    where parse = Version.parse
E        +    and   '3.14.0' = <built-in method join of str object at 0x7f7983aa1b98>(<generator object test_python_get_preferred_default.<locals>.<genexpr> at 0x7f7978fc0580>)
E        +      where <built-in method join of str object at 0x7f7983aa1b98> = '.'.join

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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08735245-poetry/

For all our attempts to build poetry with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/poetry/

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.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
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.

Comment 1 Miro Hrončok 2025-03-26 12:05:32 UTC
The test_python_get_preferred_default failure is a problem of the test. It does not work with Python pre-releases: https://github.com/python-poetry/poetry/issues/10302

Comment 2 Miro Hrončok 2025-03-26 13:58:39 UTC
https://github.com/python-poetry/poetry/pull/10303 fixes test_python_get_preferred_default

Comment 3 Tomáš Hrnčiar 2025-03-27 08:15:51 UTC
I've reported the other test upstream: https://github.com/python-poetry/poetry/issues/10306

Comment 4 Tomáš Hrnčiar 2025-05-28 12:10:13 UTC
PR: https://src.fedoraproject.org/rpms/poetry/pull-request/65


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