Skip to content

Test TestUserAgent::test_user_agent_header_format fails on a pre-release Python #2167

@musicinmybrain

Description

@musicinmybrain

On a pre-release Python interpreter version, the test TestUserAgent::test_user_agent_header_format fails. For example, with Python 3.15.0a5:

$ pytest -v -k 'TestUserAgent and test_user_agent_header_format'
=================================================================================== test session starts ====================================================================================
platform linux -- Python 3.15.0a5, pytest-9.0.2, pluggy-1.6.0 -- /home/ben/src/forks/hatch/.venv/bin/python3
cachedir: .pytest_cache
rootdir: /home/ben/src/forks/hatch
configfile: pyproject.toml
plugins: anyio-4.12.1
collected 2259 items / 2258 deselected / 1 selected                                                                                                                                        

tests/index/test_core.py::TestUserAgent::test_user_agent_header_format FAILED [100%]

========================================================================================= FAILURES =========================================================================================
_______________________________________________________________________ TestUserAgent.test_user_agent_header_format ________________________________________________________________________

self = <tests.index.test_core.TestUserAgent object at 0x7f0d343e56d0>

    def test_user_agent_header_format(self):
        index = PackageIndex("https://foo.internal/a/b/")
        client = index.client
    
        user_agent = client.headers["User-Agent"]
    
        expected = (
            f"Hatch/{__version__} {sys.implementation.name}/{platform.python_version()} HTTPX/{httpx.__version__}"
        )
>       assert user_agent == expected
E       AssertionError: assert 'Hatch/1.16.3... HTTPX/0.28.1' == 'Hatch/1.16.3... HTTPX/0.28.1'
E         
E         - Hatch/1.16.3.dev3 cpython/3.15.0a5 HTTPX/0.28.1
E         ?                                 --
E         + Hatch/1.16.3.dev3 cpython/3.15.0 HTTPX/0.28.1

/home/ben/src/forks/hatch/tests/index/test_core.py:86: AssertionError
================================================================================= short test summary info ==================================================================================
FAILED tests/index/test_core.py::TestUserAgent::test_user_agent_header_format - AssertionError: assert 'Hatch/1.16.3... HTTPX/0.28.1' == 'Hatch/1.16.3... HTTPX/0.28.1'
============================================================================ 1 failed, 2258 deselected in 0.61s ============================================================================

It looks like this is a consequence of 8e1a709, specifically 557ed17.

This was first reported downstream in Fedora.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions