pytest_httpx icon indicating copy to clipboard operation
pytest_httpx copied to clipboard

Support HTTPX 0.21 leveraging RESPX

Open lundberg opened this issue 4 years ago • 5 comments

This is a gentle proposal to start depending on RESPX, hope I'm not stepping on anyone's toes here.

Mainly I feel that by combining the efforts of pytest_httpx and RESPX, we could ease the maintenance burden together.

The pytest_httpx API is fully kept, AFAIK, by adding the same methods to a custom HTTPXMock RESPX router .

To make the diff easier to review, I've put the new code in a separate _router.py file. Also, as can be seen, most of the new code is string manipulation to preserve identical assertion outputs for the tests.

Fixes #48

lundberg avatar Oct 21 '21 10:10 lundberg

Thanks for the proposal @lundberg :) My main priority here will be to support httpx 0.20 first, and then have a look at this if that's ok ? :)

Colin-b avatar Oct 22 '21 14:10 Colin-b

My main priority here will be to support httpx 0.20 first, and then have a look at this if that's ok ? :)

Sure thing @Colin-b.

Though, this draft actually makes pytest_httpx support httpx 0.20, without changing your API 😉 .

lundberg avatar Oct 22 '21 14:10 lundberg

Rebased 👍

What's up with SonarCloud, seems to be complaining about your test files being too similar, i.e. duplicated code 😉 , nothing I can do about it.

lundberg avatar Oct 25 '21 07:10 lundberg

Bumped RESPX to support HTTPX 0.21.0.

lundberg avatar Nov 15 '21 15:11 lundberg

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
13.2% 13.2% Duplication

sonarqubecloud[bot] avatar Nov 16 '21 09:11 sonarqubecloud[bot]

Hello @lundberg , apologies for the delay. I think those projects drifted apart and to be honest I'd rather avoid adding additional dependencies to the project. Thanks again for the proposal !

Colin-b avatar Feb 20 '24 22:02 Colin-b