From cc379df861b57550986a7feb75f7e3faee21174d Mon Sep 17 00:00:00 2001 From: Luna Date: Sat, 16 Mar 2019 21:13:10 -0300 Subject: [PATCH] tests.conftest: add teardown to prevent overuse of resources --- tests/conftest.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 66c5e6f..5917a75 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -45,7 +45,11 @@ def _test_app(unused_tcp_port, event_loop): # make sure we're calling the before_serving hooks event_loop.run_until_complete(main_app.startup()) - return main_app + # https://docs.pytest.org/en/latest/fixture.html#fixture-finalization-executing-teardown-code + yield main_app + + # properly teardown + event_loop.run_until_complete(main_app.shutdown()) @pytest.fixture(name='test_cli')