During Sanic upgrade from v1.9.9 to v2.6.1 async tests were failing.
Ive made many adjustments to match the versions sanic-related packages with this version.
The tests uses SanicTestClient.
the initialization of the client is as follows:
@pytest.fixture
def test_cli(loop, app, sanic_client) -> SanicTestClient:
cli = loop.run_until_complete(sanic_client(app))
cli.server.after_server_stop = []
return cli
routes are being set as the following example (sanic-restful-api)
api.add_resource(…)
call to the API is as follows (SanicTestClient):
await test_cli.put(..
Following are test-related and sanic-related versions in use:
sanic==22.6.1
sanic-cors==2.1.0
sanic-restful-api==0.1.5
pytest==6.2.0
pytest-sanic==1.9.1
pytest==6.2.0
pytest-mock==3.6.1
pytest-postgresql==4.1.1
pytest-timeout==2.1.0
httpx==0.18.1
sanic-restful==0.1.1
sanic-routing==22.3.0
sanic-testing==22.6.0
Ill be glad for any assistance