Include asyncio task information in /-/threads debug page

This commit is contained in:
Simon Willison 2019-12-04 22:46:39 -08:00
commit d6b6c9171f
5 changed files with 41 additions and 4 deletions

View file

@ -18,6 +18,7 @@ from .fixtures import ( # noqa
)
import json
import pytest
import sys
import urllib
@ -1229,6 +1230,14 @@ def test_metadata_json(app_client):
assert METADATA == response.json
def test_threads_json(app_client):
response = app_client.get("/-/threads.json")
expected_keys = {"threads", "num_threads"}
if sys.version_info >= (3, 7, 0):
expected_keys.update({"tasks", "num_tasks"})
assert expected_keys == set(response.json.keys())
def test_plugins_json(app_client):
response = app_client.get("/-/plugins.json")
assert [