#31407 closed Cleanup/optimization (fixed)
RuntimeWarning when running AsyncHandlerRequestTests.test_unawaited_response.
Reported by: | Deep Sukhwani | Owned by: | Carlton Gibson |
---|---|---|---|
Component: | Testing framework | Version: | 3.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Steps to reproduce:
- Use a Python virtualenv with Python 3.7.7 / Python 3.8.2
- Install requirements - from Django root with latest master (of the the date of this issue):
cd tests && pip install -r requirements/py3.txt
- Run tests
export DJANGO_TEST_PROCESSES=1; export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES; ./runtests.py
- This is reproducible in django-docker-box using Python 3.7 and Python 3.8, verified as follows:
PYTHON_VERSION=3.7 docker-compose run --rm sqlite
PYTHON_VERSION=3.8 docker-compose run --rm sqlite
Notes:
- To ensure this is not happening due to parallelization, I had set
export DJANGO_TEST_PROCESSES=1;
while triggering./runtests.py
Warning text:
Exception ignored in: <coroutine object sleep at 0x130ef1320> Traceback (most recent call last): File "/Users/ds/.pyenv/versions/3.7.7/lib/python3.7/warnings.py", line 518, in _warn_unawaited_coroutine warn(msg, category=RuntimeWarning, stacklevel=2, source=coro) RuntimeWarning: coroutine 'sleep' was never awaited
Other Observations:
- This warning was not observed when running tests with Python 3.6, verified on macOS and django-docker-box. For
django-docker-box
the tests were run using:PYTHON_VERSION=3.6 docker-compose run --rm sqlite
Change History (12)
comment:1 by , 5 years ago
Easy pickings: | set |
---|---|
Summary: | "RuntimeWarning: coroutine 'sleep' was never awaited" observed when running tests with Python 3.7 and Python 3.8 → RuntimeWarning when running AsyncHandlerRequestTests.test_unawaited_response. |
Triage Stage: | Unreviewed → Accepted |
Type: | Bug → Cleanup/optimization |
follow-up: 3 comment:2 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 5 years ago
Replying to Mahdi Sadeghzadeh Ghamsary:
How are you going with this? Otherwise I would gladly take a shot a this
comment:4 by , 5 years ago
Owner: | changed from | to
---|
comment:7 by , 5 years ago
Has patch: | unset |
---|---|
Resolution: | fixed |
Status: | closed → new |
With this fix we have the same warning but after all tests, e.g.
./runtests.py handlers --parallel=1 Testing against Django installed in 'django/django' Creating test database for alias 'default'... System check identified no issues (0 silenced). ............................. ---------------------------------------------------------------------- Ran 29 tests in 0.377s OK Destroying test database for alias 'default'... Exception ignored in: <coroutine object sleep at 0x7fc660d70040> RuntimeWarning: coroutine 'sleep' was never awaited
comment:8 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
OK, I will take another look. (I had this clearing up OK the other day so...) Thanks Mariusz.
comment:10 by , 5 years ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Version 0, edited 5 years ago by (next)
Note:
See TracTickets
for help on using tickets.
handlers.tests.AsyncHandlerRequestTests.test_unawaited_response
raises this warning because it tests unawaited coroutine. I agree that we can suppress this warning.