Skip to content

chore: upgrade urllib to latest#240

Merged
BartoszBlizniak merged 9 commits intomasterfrom
ceng-611-cloudsmith-cli-upgrade-urllib3-from-1x-to-2x-issue-150
Dec 16, 2025
Merged

chore: upgrade urllib to latest#240
BartoszBlizniak merged 9 commits intomasterfrom
ceng-611-cloudsmith-cli-upgrade-urllib3-from-1x-to-2x-issue-150

Conversation

@BartoszBlizniak
Copy link
Copy Markdown
Member

@BartoszBlizniak BartoszBlizniak commented Nov 26, 2025

@BartoszBlizniak
Copy link
Copy Markdown
Member Author

Hmmm, after upgrading from urllib3 1.26.0 to 2.5.0, the test test_implicit_retry_for_status_codes in test_rest.py began failing when run in isolation:

FAILED **********_cli/core/tests/test_rest.py::TestRestClient::test_implicit_retry_for_status_codes - httpretty.errors.UnmockedError: Failed to socket.shutdown because because a real socket does not exist

There is an open issue on HttpPretty which is still open and is the cause of this error.

Until that's resolved, we can mock the keyring in order to allow this individual test to pass.

When running the test suite which includes all tests:

> pytest cloudsmith_cli/core/tests/test_*.py
=== test session starts ===
platform darwin -- Python 3.14.0, pytest-7.4.0, pluggy-1.2.0
rootdir: /Users/<redacted>/GitHub/cloudsmith-cli
configfile: setup.cfg
plugins: cov-4.1.0
collected 42 items                                                                                                                                                                                                          

cloudsmith_cli/core/tests/test_download.py ......................                                                                                                                                                     [ 52%]
cloudsmith_cli/core/tests/test_init.py ....                                                                                                                                                                           [ 61%]
cloudsmith_cli/core/tests/test_keyring.py ..............                                                                                                                                                              [ 95%]
cloudsmith_cli/core/tests/test_rest.py .                                                                                                                                                                              [ 97%]
cloudsmith_cli/core/tests/test_version.py .                                                                                                                                                                           [100%]

=== 42 passed, 6 warnings in 8.03s ===

Results in a pass.

The data = None assignment was added due to local pre-commit (pylint) complaining

@BartoszBlizniak BartoszBlizniak marked this pull request as ready for review December 16, 2025 10:41
@BartoszBlizniak BartoszBlizniak requested a review from a team as a code owner December 16, 2025 10:42
Copilot AI review requested due to automatic review settings December 16, 2025 10:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades urllib3 from v1.26.20 to v2.5.0 to align with the urllib3 v2 migration guide. The changes include updating dependency constraints, adapting code to use the new urllib3 v2 API, and fixing test compatibility issues.

Key changes:

  • Updated urllib3 version constraints in dependency files and migrated deprecated API parameters
  • Added test fixture to handle urllib3 v2 socket shutdown behavior with httpretty mocking
  • Fixed potential undefined variable issue in entitlements metrics command

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
setup.py Updated urllib3 dependency constraint from <2.0 to >=2.5
requirements.txt Updated pinned urllib3 version from 1.26.20 to 2.5.0
cloudsmith_cli/core/rest.py Replaced deprecated method_whitelist parameter with allowed_methods for urllib3 v2 compatibility
cloudsmith_cli/core/tests/test_rest.py Added mock_keyring fixture to handle urllib3 v2 socket shutdown behavior and prevent SSO token refresh during isolated tests
cloudsmith_cli/cli/commands/metrics/entitlements.py Added data = None initialization to prevent potential undefined variable issues
CHANGELOG.md Documented urllib3 upgrade, test fixture addition, and entitlement token list command fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

BartoszBlizniak and others added 2 commits December 16, 2025 10:55
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@BartoszBlizniak BartoszBlizniak merged commit 8bf84fe into master Dec 16, 2025
13 checks passed
@BartoszBlizniak BartoszBlizniak deleted the ceng-611-cloudsmith-cli-upgrade-urllib3-from-1x-to-2x-issue-150 branch December 16, 2025 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants