Skip to content

Handling prereleases of Python is incomplete (3.15.0a6 doesn't pass test_satisfies_version_specifier or test_discovery_via_version_specifier) #45

@befeleme

Description

@befeleme

I'm testing Python 3.15.0a6 in Fedora Linux and build libraries with it. Two tests using major and minor version specifiers to set up an environment, fail unexpectedly. It looks like this requires more robust handling: the specifier defined as 3.15 will (correctly) sort higher than 3.15.0a6, but the expectations of the tests - that "current" matches what was created - fail:

_____________________ test_discovery_via_version_specifier _____________________

session_cache = <python_discovery._cache.DiskCache object at 0x7fe33c3de120>

    def test_discovery_via_version_specifier(session_cache: DiskCache) -> None:
        current = PythonInfo.current_system(session_cache)
        major, minor = current.version_info.major, current.version_info.minor
    
        spec = f">={major}.{minor}"
        interpreter = get_interpreter(spec, [], session_cache)
>       assert interpreter is not None
E       assert None is not None

tests/test_discovery.py:240: AssertionError
_______________________ test_satisfies_version_specifier _______________________

    def test_satisfies_version_specifier() -> None:
        spec = PythonSpec.from_string_spec(f">={sys.version_info.major}.{sys.version_info.minor}")
>       assert CURRENT.satisfies(spec, impl_must_match=False) is True
E       AssertionError: assert False is True
E        +  where False = satisfies(PythonSpec(version_specifier=>=3.15), impl_must_match=False)
E        +    where satisfies = PythonInfo({'platform': 'linux', 'implementation': 'CPython', 'version_info': VersionInfo(major=3, minor=15, micro=0, releaselevel='alpha', serial=6), 'architecture': 64, 'sysconfig_platform': 'linux-x86_64', 'version_nodot': '315', 'version': '3.15.0a6 (main, Feb 12 2026, 00:00:00) [GCC 16.0.1 20260209 (Red Hat 16.0.1-0)]', 'os': 'posix', 'free_threaded': False, 'prefix': '/usr', 'base_prefix': '/usr', 'real_prefix': None, 'base_exec_prefix': '/usr', 'exec_prefix': '/usr', 'executable': '/usr/bin/python3', 'original_executable': '/usr/bin/python3', 'system_executable': '/usr/bin/python3', 'has_venv': True, 'path': ['/builddir/build/BUILD/python-discovery-1.1.1-build/python-discovery-1.1.1/tests/windows', '/builddir/build/BUILD/python-discovery-1.1.1-build/python-discovery-1.1.1/tests', '/builddir/build/BUILD/python-discovery-1.1.1-build/python-discovery-1.1.1/tests/py_info', '/builddir/build/BUILD/python-discovery-1.1.1-build/python-discovery-1.1.1/tests', '/builddir/build/BUILD/python-discovery-1.1.1-build/BUILDROOT/usr/lib64/python3.15/site-packages', '/builddir/build/BUILD/python-discovery-1.1.1-build/BUILDROOT/usr/lib/python3.15/site-packages', '/usr/lib64/python315.zip', '/... 'utf-8', 'stdout_encoding': 'utf-8', 'sysconfig_scheme': 'venv', 'sysconfig_paths': {'stdlib': '{installed_base}/{platlibdir}/{implementation_lower}{py_version_short}{abi_thread}', 'platstdlib': '{platbase}/{platlibdir}/{implementation_lower}{py_version_short}{abi_thread}', 'purelib': '{base}/lib/{implementation_lower}{py_version_short}{abi_thread}/site-packages', 'platlib': '{platbase}/{platlibdir}/{implementation_lower}{py_version_short}{abi_thread}/site-packages', 'include': '{installed_base}/include/{implementation_lower}{py_version_short}{abiflags}', 'scripts': '{base}/bin', 'data': '{base}'}, 'distutils_install': {}, 'sysconfig': {'makefile_filename': '/usr/lib64/python3.15/config-3.15-x86_64-linux-gnu/Makefile'}, 'sysconfig_vars': {'py_version_short': '3.15', 'implementation_lower': 'python', 'abiflags': '', 'base': '/usr', 'INSTSONAME': 'libpython3.15.so.1.0', 'installed_base': '/usr', 'platlibdir': 'lib64', 'LIBDIR': '/usr/lib64', 'Py_ENABLE_SHARED': 1, 'PYTHONFRAMEWORK': '', 'abi_thread': '', 'platbase': '/usr'}, 'tcl_lib': None, 'tk_lib': None, 'system_stdlib': '/usr/lib64/python3.15', 'system_stdlib_platform': '/usr/lib64/python3.15', 'max_size': 9223372036854775807}).satisfies

tests/test_py_info_extra.py:271: AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions