【发布时间】:2019-07-20 02:30:21
【问题描述】:
我正在运行 pytest-3。我正在定义一个应该返回 falcon TestClient 对象的夹具。我也需要拆解,所以我正在尝试让步。
def client():
api=create_app()
c = testing.TestClient(api)
yield c
remove_db()
如果我'return'而不是'yield',测试用例运行得很好。 但是通过 yield,我的测试用例得到了一个生成器对象而不是一个 TestClient 对象
【问题讨论】:
标签: python-3.x pytest falconframework