Skip to content

Fix test mock - #442

Merged
hugovk merged 1 commit into
python:mainfrom
hugovk:fix-test
Oct 3, 2026
Merged

hugovk merged 1 commit into
python:mainfrom
hugovk:fix-test

Conversation

@hugovk

@hugovk hugovk commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Fresh upstream test run after 3.13 became security-only:

__________________ test_tag_is_security_release[3.13.3-False] __________________

version = '3.13.3', expected = False
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f8a4d3a2890>

    @pytest.mark.parametrize(
        ["version", "expected"],
        [
            ("3.12.10", True),
            ("3.13.3", False),
        ],
    )
    def test_tag_is_security_release(
        version: str, expected: bool, mocker: MockerFixture
    ) -> None:
        # Arrange
        mock_response = b"""
        {
            "3.13": {
                "status": "bugfix"
            },
            "3.12": {
                "status": "security"
            }
        }
        """
        mocker.patch("urllib.request.urlopen", return_value=io.BytesIO(mock_response))
    
        # Act
        tag = release.Tag(version)
    
        # Assert
>       assert tag.is_security_release is expected
E       assert True is False
E        +  where True = <release.Tag object at 0x7f8a4d2e8d40>.is_security_release

https://github.com/python/release-tools/actions/runs/37047689795/job/110973075475

The mock wasn't properly mocking, and the test was fetching live data.

3.13 just went bugfix->security, so it failed.

@hugovk
hugovk merged commit 9597037 into python:main Oct 3, 2026
10 checks passed
@hugovk
hugovk deleted the fix-test branch October 3, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant