**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`
--
Ticket URL: <https://code.djangoproject.com/ticket/31407>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* type: Bug => Cleanup/optimization
* easy: 0 => 1
* stage: Unreviewed => Accepted
Comment:
`handlers.tests.AsyncHandlerRequestTests.test_unawaited_response` raises
this warning because it tests unawaited coroutine. I agree that we can
suppress this warning.
--
Ticket URL: <https://code.djangoproject.com/ticket/31407#comment:1>
* owner: nobody => Rafael Arellano
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/31407#comment:2>
* owner: Rafael Arellano => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/31407#comment:3>
* owner: nobody => MSadeghzadehG
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/31407#comment:2>
Comment (by Mark):
Replying to [comment:2 Mahdi Sadeghzadeh Ghamsary]:
How are you going with this? Otherwise I would gladly take a shot a this
--
Ticket URL: <https://code.djangoproject.com/ticket/31407#comment:3>
* owner: Mahdi Sadeghzadeh Ghamsary => Mark
--
Ticket URL: <https://code.djangoproject.com/ticket/31407#comment:4>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/12661 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/31407#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"590957a0eb9a87a6f2bd3463226b0a7f1405d817" 590957a]:
{{{
#!CommitTicketReference repository=""
revision="590957a0eb9a87a6f2bd3463226b0a7f1405d817"
Fixed #31407 -- Adjusted test to avoid coroutine never awaited warning.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31407#comment:6>
* status: closed => new
* has_patch: 1 => 0
* resolution: fixed =>
Comment:
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
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31407#comment:7>
* owner: Mark => Carlton Gibson
* status: new => assigned
Comment:
OK, I will take another look. (I had this clearing up OK the other day
so...) Thanks Mariusz.
--
Ticket URL: <https://code.djangoproject.com/ticket/31407#comment:8>
Comment (by Carlton Gibson):
[https://github.com/django/django/pull/12691 New PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/31407#comment:9>
* has_patch: 0 => 1
* stage: Accepted => Ready for checkin
Comment:
[https://github.com/django/django/pull/12691 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/31407#comment:10>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"ed274a4ae4665b5c7a367670b0c89c8eeed1c8b4" ed274a4a]:
{{{
#!CommitTicketReference repository=""
revision="ed274a4ae4665b5c7a367670b0c89c8eeed1c8b4"
Fixed #31407 -- Fixed unawaited coroutine warning for Python 3.8+.
Co-authored-by: Mark Korput <dr.t...@gmail.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31407#comment:11>
Comment (by Carlton Gibson <carlton@…>):
In [changeset:"236e6cb5881168a79a194b43c2d8dff7a14c3f03" 236e6cb5]:
{{{
#!CommitTicketReference repository=""
revision="236e6cb5881168a79a194b43c2d8dff7a14c3f03"
Refs #31407 -- Handled potential exception in test cleanup.
The test view may not be called when running the tests with
--parallel=2 or greater. Catch the AttributeError for this case.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31407#comment:12>