有基本测试
from aiohttp import web
async def hello(request):
return web.Response(text='Hello, world')
async def test_hello(test_client, loop):
app = web.Application()
app.router.add_get('/', hello)
client = await test_client(app)
resp = await client.get('/')
assert resp.status == 200
text = await resp.text()
assert 'Hello, world' in text
fixture' test_client'找不到
available fixtures: cache, capfd, capsys, doctest_namespace, event_loop, event_loop_process_pool, loop, monkeypatch,
pytestconfig,record_xml_property,recwarn,tmpdir,tmpdir_factory,unused_tcp_port,unused_tcp_port_factory
答案 0 :(得分:0)