New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[tests] Add tests for socks proxies #7908
Merged
coletdjnz
merged 13 commits into
yt-dlp:master
from
coletdjnz:feature/networking/socks-tests
Aug 25, 2023
Merged
[tests] Add tests for socks proxies #7908
coletdjnz
merged 13 commits into
yt-dlp:master
from
coletdjnz:feature/networking/socks-tests
Aug 25, 2023
Conversation
This file contains 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
Grub4K
reviewed
Aug 20, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cosmetic things mainly
10 tasks
aalsuwaidi
pushed a commit
to aalsuwaidi/yt-dlp
that referenced
this pull request
Apr 21, 2024
Authored by: coletdjnz
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.
This PR implements some long needed test cases for our socks proxy module. Previously, only a few e2e tests were implemented and were disabled by default.
As part of this I have written basic socks4/5 dummy proxy servers (as per the specs) that allow us to get back proxy debug information to test against.
Instead of testing the socks.py module directly, I am testing at the handler level. This is to allow us to test socks proxy implementations in multiple handlers. Additionally, the tests are written to work with different protocols other than http (for when we need to implement websockets over socks, for instance).
When writing these tests, the following bugs/issues with our socks client implementation have been found:
--source-address
is not obeyed for either socks4 and socks5Tests have been written for these cases but are currently skipped until they are fixed. I plan to look into these in followup PRs.
Template
Before submitting a pull request make sure you have:
In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:
What is the purpose of your pull request?
Copilot Summary
馃 Generated by Copilot at 37438eb
Summary
馃搫馃敡馃И
Refactor networking tests and add a
handler
fixture. This change improves the code structure and reusability of the tests for different networking backends.Walkthrough
handler
inconftest.py
that returns a partial function of a request handler class based on the parameter passed to the test function (link)handler
fixture to test different networking backends for yt-dlp, such as urllib, pycurl, etc. (link, link, link)test_networking.py
toconftest.py
since they are only used by thehandler
fixture and not by the test functions (link)_REQUEST_HANDLERS
fromtest_networking.py
since it is no longer needed there (link)handler
fixture fromtest_networking.py
since it is now moved toconftest.py
(link)