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

tests/test_formdata.py::test_mark_formdata_as_processed relies on external web server #5840

Closed
1 task done
derlih opened this issue Jun 29, 2021 · 2 comments · Fixed by #5843
Closed
1 task done
Labels

Comments

@derlih
Copy link
Contributor

derlih commented Jun 29, 2021

Describe the bug

This test uses http://httpbin.org to send the request. If this server is not responding, the test will fail.
Actually I caught this problem in CI while I was working on a PR. This makes aiohttp CI not so reliable.

postmanlabs/httpbin#150 (comment)

To Reproduce

Sometimes it just happen.

Expected behavior

Use local instance of httpbin or use aiohttp test server if possible.

Logs/tracebacks

n/a

Python Version

$ python --version
Python 3.8.5

aiohttp Version

$ python -m pip show aiohttp
Name: aiohttp
Version: 4.0.0a1
Summary: Async http client/server framework (asyncio)
Home-page: https://github.com/aio-libs/aiohttp
Author: Nikolay Kim
Author-email: [email protected]
License: Apache 2
Location: /home/dmitry/Sources/aiohttp
Requires: chardet, multidict, async-timeout, yarl, typing-extensions, frozenlist, aiosignal
Required-by:

multidict Version

$ python -m pip show multidict
Name: multidict
Version: 5.1.0
Summary: multidict implementation
Home-page: https://github.com/aio-libs/multidict
Author: Andrew Svetlov
Author-email: [email protected]
License: Apache 2
Location: /home/dmitry/Sources/aiohttp/venv/lib/python3.8/site-packages
Requires: 
Required-by: yarl, aiohttp

yarl Version

$ python -m pip show yarl
Name: yarl
Version: 1.6.3
Summary: Yet another URL library
Home-page: https://github.com/aio-libs/yarl/
Author: Andrew Svetlov
Author-email: [email protected]
License: Apache 2
Location: /home/dmitry/Sources/aiohttp/venv/lib/python3.8/site-packages
Requires: idna, multidict
Required-by: aiohttp

OS

ubuntu 20.04
but happen in CI for mac

Related component

Client

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@derlih derlih added the bug label Jun 29, 2021
@Dreamsorcerer
Copy link
Member

Dreamsorcerer commented Jun 29, 2021

Doesn't look like the test has anything to do with httpbin.org. It just needs to send a post request somewhere twice.

Also, it appears the original commit raises a RuntimeError, when it should probably raise some kind of client error, and in fact the change file says it raises a ClientPayloadError...
Nevermind: #4351 (comment)

0273535

@derlih
Copy link
Contributor Author

derlih commented Jun 30, 2021

async def test_mark_formdata_as_processed() -> None:
async with ClientSession() as session:
url = "http://httpbin.org/anything"
data = FormData()
data.add_field("test", "test_value", content_type="application/json")
await session.post(url, data=data)
assert len(data._writer._parts) == 1
with pytest.raises(RuntimeError):
await session.post(url, data=data)

I think so too. IMO it would be better to use aiohttp server instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants