Skip to content

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

@andrew-tipton-cgg

Description

@andrew-tipton-cgg

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions