我正在运行 pytest-3。我正在定义一个应该返回 falcon TestClient 对象的装置。我还需要拆解,所以我正在努力放弃它。
def client():
api=create_app()
c = testing.TestClient(api)
yield c
remove_db()
Run Code Online (Sandbox Code Playgroud)
如果我“返回”而不是“yield”,则测试用例运行得很好。但是通过收益,我的测试用例得到一个生成器对象而不是 TestClient 对象