Skip to content
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

Consider using wsgi_intercept instead of starting an HTTP server? #35

Open
andrew-tipton-cgg opened this issue Jul 27, 2016 · 1 comment

Comments

@andrew-tipton-cgg
Copy link

I'm investigating various approaches for using py.test to unit test some code which makes HTTP requests. (It's a class that invokes webhooks in the background.)

I like the approach of pytest-httpbin, because using fixtures can keep the test cases from getting too cluttered with extraneous setup/teardown code. However, I'm not too keen on the idea of spawning an actual HTTP server in the background, because the code under test is already using a known-good HTTP client library.

What about using wsgi_intercept? It basically does what it says on the tin: intercept outgoing HTTP requests and redirect them to an in-process WSGI application. No actual HTTP client or server is involved!

Any reason why this wouldn't work or isn't a good idea? Would you accept a pull request that implemented this feature?

@ml31415
Copy link

ml31415 commented Jun 14, 2023

Yeah, that might be a good option to have. E.g. with running gevent, just spawning some other threads on the side suddenly becomes more of an issue.

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

No branches or pull requests

2 participants