`py/test/selenium/webdriver/common/network.py`: remove python 2 code
User description
Thanks for contributing to Selenium! A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines. Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
Removes dead Python 2 code from py/test/selenium/webdriver/common/network.py as Python 2 support is now dropped
Motivation and Context
Migrate to Python 3 from Python 2
Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist
- [x] I have read the contributing document.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [x] All new and existing tests passed.
PR Type
enhancement
Description
- Removed obsolete Python 2 compatibility code from
py/test/selenium/webdriver/common/network.py. - Simplified the
_bytesfunction to only support Python 3, reflecting the project's migration to Python 3.
Changes walkthrough 📝
| Relevant files | |||
|---|---|---|---|
| Enhancement |
|
💡 PR-Agent usage: Comment
/helpon the PR to get a list of all available PR-Agent tools and their descriptions
PR Reviewer Guide 🔍
| ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪ |
| 🧪 No relevant tests |
| 🔒 No security concerns identified |
| ⚡ No key issues to review |
PR Code Suggestions ✨
| Category | Suggestion | Score |
| Best practice |
Use a context manager for the socket to ensure proper resource managementConsider using a context manager (with statement) for the socket to ensure it's py/test/selenium/webdriver/common/network.py [30-32]
Suggestion importance[1-10]: 9Why: Using a context manager for the socket is a best practice that ensures proper resource management and prevents potential resource leaks, making it a valuable improvement. | 9 |
| Enhancement |
Move the helper function outside the main function to improve code structureConsider moving the py/test/selenium/webdriver/common/network.py [26-32]
Suggestion importance[1-10]: 7Why: Moving the | 7 |
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 57.66%. Comparing base (
b2ef56a) to head (12d9ccf). Report is 41 commits behind head on trunk.
Additional details and impacted files
@@ Coverage Diff @@
## trunk #14502 +/- ##
==========================================
- Coverage 57.67% 57.66% -0.02%
==========================================
Files 89 89
Lines 5578 5586 +8
Branches 240 245 +5
==========================================
+ Hits 3217 3221 +4
+ Misses 2121 2120 -1
- Partials 240 245 +5
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Test failures seen here are unrelated to the changes in this PR.
RBE Test failures:
- //dotnet/test/common:DevTools/DevToolsConsoleTest-edge
- //dotnet/test/common:DevTools/DevToolsNetworkTest-chrome
- //java/test/org/openqa/selenium/chrome:ChromeOptionsFunctionalTest-remote