有一个基本的测试
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找不到夹具'test_client‘
可提供的固定装置:缓存、capfd、capsys、doctest_namespace、event_loop、event_loop_process_pool、循环、monkeypatch pytestconfig,record_xml_property,recwarn,tmpdir,tmpdir_factory,unused_tcp_port,unused_tcp_port_factory
发布于 2017-11-18 05:00:15
https://stackoverflow.com/questions/47360025
复制相似问题