I have a test suite that makes real API calls to the Sanic application server instance.
My test suite calls the “after_server_stop” registered listener handler after each test run, which shut down the application’s async sessions and tasks, and that makes the second test (and so on) to fail because each sequent test makes a call with a new async session and fails for “cannot schedule new futures after shutdown”
- How can I unregister a certain listener just for the test suite run
- What is the proper way (with code example) to keep an event loop running throughout all test suites run complete, and only then to shut sessions
My sanic, and pytest version