Commit ec4e653
authored
Fix asyncio.iscoroutinefunction() deprecation warnings (#2251)
Fix these warnings seen in the test run:
```
test middleware switches to async (__acall__) based on get_response type ... /home/runner/work/django-debug-toolbar/django-debug-toolbar/tests/test_middleware.py:57: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead
self.assertTrue(asyncio.iscoroutinefunction(middleware))
test middleware switches to sync (__call__) based on get_response type ... /home/runner/work/django-debug-toolbar/django-debug-toolbar/tests/test_middleware.py:38: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead
self.assertFalse(asyncio.iscoroutinefunction(middleware))
```
[`inspect.iscoroutinefunction()`](https://docs.python.org/3/library/inspect.html#inspect.iscoroutinefunction) has always been the public API, since Python 3.5, though we need `markcoroutine()` support, which was added in Python 3.12.1 parent 5321f6d commit ec4e653
1 file changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
| |||
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
38 | | - | |
| 43 | + | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
| |||
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
57 | | - | |
| 62 | + | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
| |||
0 commit comments