ross / requests-futures

Asynchronous Python HTTP Requests for Humans using Futures
Other
2.11k stars 152 forks source link

Use pytest-httpbin? #136

Closed mgorny closed 1 year ago

mgorny commented 1 year ago

Is there a specific need to use a public httpbin service during tests? E.g. pytest-httpbin can easily provide the equivalent service locally and would make the test suite work reliably independently of the current state of Internet connection and the remote service.

ross commented 1 year ago

Nothing prevents using pytest-httpbin. It didn't exist when things were first written and I didn't find anything similar at the time.

mgorny commented 1 year ago

Ah, cool. Does that mean you're likely to do it or more like you're open to pull requests if somebody else does it?

ross commented 1 year ago

Ah, cool. Does that mean you're likely to do it or more like you're open to pull requests if somebody else does it?

It'll happen faster if someone else opens the PR. Otherwise it'll get throw onto my TODO list with fairly low priority since it's just a testing improvement and not a super meaningful change for clients.

mgorny commented 1 year ago

It should be trivial but right now httpbin doesn't work out of the box without patching or restricting werkzeug version, and I think it's better to solve that at pytest-httpbin level than add workarounds here. I've asked for a workaround on https://github.com/kevin1024/pytest-httpbin/issues/72.

mgorny commented 1 year ago

Ok, httpbin is fixed now. However, FWICS the test suite is currently using the unittest-based class approach which is incompatible with pytest fixtures. Would you mind me rewriting the test suite to use pure pytest?

ross commented 1 year ago

Would you mind me rewriting the test suite to use pure pytest?

Should be fine. Don't imagine it changes much.

mgorny commented 1 year ago

Actually, I've found out how to combine fixtures with unittest-style tests, so I managed without ;-). I'll submit a "minimal change" PR in a minute.

mgorny commented 1 year ago

139 now.