Fix test mock - #442
Merged
Merged
Fix test mock#442
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_releasehttps://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.