Skip to content

Add support for optionally patching httpx #122

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 2, 2020
Merged

Add support for optionally patching httpx #122

merged 3 commits into from
Dec 2, 2020

Conversation

lundberg
Copy link
Owner

@lundberg lundberg commented Dec 2, 2020

Adds httpx mocker to optionally patch HTTPX client rather than httpcore transports.

@respx.mock(using="httpx")
def test():
    ...

If not specified, the default is still using="httpcore", as of #118.

@codecov-io
Copy link

Codecov Report

Merging #122 (9b16b34) into master (5f01134) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            master      #122    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           16        16            
  Lines         2328      2435   +107     
  Branches       138       142     +4     
==========================================
+ Hits          2328      2435   +107     
Impacted Files Coverage Δ
respx/mocks.py 100.00% <100.00%> (ø)
respx/models.py 100.00% <100.00%> (ø)
respx/router.py 100.00% <100.00%> (ø)
respx/transports.py 100.00% <100.00%> (ø)
respx/types.py 100.00% <100.00%> (ø)
tests/conftest.py 100.00% <100.00%> (ø)
tests/test_api.py 100.00% <100.00%> (ø)
tests/test_mock.py 100.00% <100.00%> (ø)
tests/test_router.py 100.00% <100.00%> (ø)
tests/test_transports.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f01134...9b16b34. Read the comment docs.

@lundberg lundberg merged commit d8fc5ad into master Dec 2, 2020
@lundberg lundberg deleted the httpx-mocker branch December 2, 2020 22:57
lundberg added a commit that referenced this pull request Dec 14, 2020
Fixed
- Fixed decorator `respx_mock` kwarg, mistreated as a `pytest` fixture. (PR #117)
- Fixed `JSON` pattern sometimes causing a `JSONDecodeError`. (PR #124)

Added
- Snapshot and rollback of routes' pattern and name. (PR #120)
- Internally extracted a `RouteList` from `Router`. (PR #120)
- Auto registration of `Mocker` implementations and their `using` name. (PR #121)
- Added `HTTPXMocker`, optionally patching `HTTPX`. (PR #122)

Changed
- Protected a routes' pattern to be modified. (PR #120)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants