Hello,
I have seen the docs which use the Sanic test client in order to test routes etc. A sample code would be:
from myservice import app # sanic app
def test_1():
req, rsp = app.test_client.get('/aroute')
return
However, my problem is that app
initialization takes several seconds. Therefore, adding another test case to invoke test client on another route seems unnecessary.
The obvious solution is to init the app just once, in a pytest setup()
method. But I can’t figure out a way to achieve so? How do I init the app and just use it across all test class’ methods?
Thanks