tests: make test app fixture async

This commit is contained in:
Luna 2021-09-05 18:29:03 -03:00
parent de4c5a5e75
commit 948627efd1
1 changed files with 3 additions and 3 deletions

View File

@ -36,7 +36,7 @@ from litecord.blueprints.auth import make_token
@pytest.fixture(name="app") @pytest.fixture(name="app")
def _test_app(unused_tcp_port, event_loop): async def _test_app(unused_tcp_port):
set_blueprints(main_app) set_blueprints(main_app)
main_app.config["_testing"] = True main_app.config["_testing"] = True
@ -53,13 +53,13 @@ def _test_app(unused_tcp_port, event_loop):
main_app.config["REGISTRATIONS"] = True main_app.config["REGISTRATIONS"] = True
# make sure we're calling the before_serving hooks # make sure we're calling the before_serving hooks
event_loop.run_until_complete(main_app.startup()) await main_app.startup()
# https://docs.pytest.org/en/latest/fixture.html#fixture-finalization-executing-teardown-code # https://docs.pytest.org/en/latest/fixture.html#fixture-finalization-executing-teardown-code
yield main_app yield main_app
# properly teardown # properly teardown
event_loop.run_until_complete(main_app.shutdown()) await main_app.shutdown()
@pytest.fixture(name="test_cli") @pytest.fixture(name="test_cli")