Split sync and async HTTPX handlers
In https://github.com/kevin1024/vcrpy/pull/943#discussion_r2446643448, sending sync requests in async contexts was accidentally broken. As #957 and #958 correctly point out, this is because the future's result was not awaited.
Instead of creating a separate event loop as #957 and #958 do, I have opted to properly separate the sync and async HTTPX handlers, as the only reason async functions were being run in a sync context was to reuse the functions.
To do this, I have pushed the logic to convert the byte stream (which is the only truly async function) up into the respective sync/async handlers, which allows the other functions to be sync (and thus callable from the respective handlers without additional work).
I have also added a test for this regression and removed the extraneous pytest.mark.online markers.
Tagging @jairhenrique given you reviewed my previous PR, I think this is a fairly important bugfix.
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 92.32%. Comparing base (2c4df79) to head (1ef0356).
:warning: Report is 22 commits behind head on master.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@ Coverage Diff @@
## master #965 +/- ##
==========================================
+ Coverage 92.23% 92.32% +0.08%
==========================================
Files 27 27
Lines 1868 1863 -5
Branches 249 248 -1
==========================================
- Hits 1723 1720 -3
+ Misses 97 94 -3
- Partials 48 49 +1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.