Thanks to visit codestin.com
Credit goes to github.com

Skip to content

tests: refactor thread handshakes#5017

Merged
gravyboat merged 1 commit into
streamlink:masterfrom
bastimeyer:tests/handshake
Dec 9, 2022
Merged

tests: refactor thread handshakes#5017
gravyboat merged 1 commit into
streamlink:masterfrom
bastimeyer:tests/handshake

Conversation

@bastimeyer

Copy link
Copy Markdown
Member

This cleans up and simplifies the HLS test mixins by implementing a generic thread-handshake class for synchronizing code execution between two threads: application logic (producer thread) and tests (consumer/main thread), with optional error capturing. The previous implementation was using a similar setup in multiple different classes. This is now defined with a proper interface and proper method names, for much better readability of the tests.

I've also added support for async coroutines in case this is required at some point. And I added tests for the new tests.testutils.handshake.Handshake class, so that it doesn't get tested implicitly via the other tests.

This work is required for my code refactoring of the CLI's read_stream() stuff (see #4974 - not yet finished), because I didn't want to redefine the same handshake stuff over and over again. Including this work in a single PR would've been a bit too much, so that's why I'm opening this one here first.

@gravyboat gravyboat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@bastimeyer My review is primarily based on the prior commit you pushed but I don't see any significant differences between them unless I'm missing something. Looks good, minor question around a name but otherwise 👍

Comment thread tests/mixins/stream_hls.py
@gravyboat gravyboat merged commit f8a1bdc into streamlink:master Dec 9, 2022
@bastimeyer bastimeyer deleted the tests/handshake branch December 9, 2022 20:01
snorkelopstesting3-bot pushed a commit to snorkel-marlin-repos/streamlink_streamlink_pr_5017_36c2174a-eb9a-49c3-878f-463624b9a4d0 that referenced this pull request Oct 22, 2025
Original PR #5017 by bastimeyer
Original: streamlink/streamlink#5017
snorkelopstesting3-bot added a commit to snorkel-marlin-repos/streamlink_streamlink_pr_5017_36c2174a-eb9a-49c3-878f-463624b9a4d0 that referenced this pull request Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants