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

Testing aiohttp as a library #465

Closed
EliRibble opened this issue Aug 11, 2015 · 3 comments
Closed

Testing aiohttp as a library #465

EliRibble opened this issue Aug 11, 2015 · 3 comments
Labels

Comments

@EliRibble
Copy link
Contributor

I apologize if an issue is an inappropriate way to discuss this, but the only discussion location I could find on aiohttp was the discus forum which was conspicuously empty.

I'm creating a project using aiohttp to make HTTP requests to remote servers. I'd like to test this project. This means I need a way to essentially mock out HTTP requests during testing so I don't actually attempt to talk to these remote servers. I've used HTTPretty in the past, which I'm very fond of. It does not work with asyncio and there's non-trivial work to get it to work. I see that aiohttp has a test suite for itself, but I have not been able to find any tools for writing tests that mock/patch aiohttp itself so I can assert that the correct requests will be made to the expected locations or that errors are properly handled. Does such tooling exist? If not, would it be appropriate to add something like a FakeTransport/FakeConnector into aiohttp that could be used to capture requests and supply pre-canned responses? I may be interesting in writing it, if so, but I want to make sure that would be something reasonable and get ideas for a good approach as I'm just getting started reading the code.

@asvetlov
Copy link
Member

See also #423

@EliRibble
Copy link
Contributor Author

Thanks.

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants