diff --git a/tests/conftest.py b/tests/conftest.py index 3302254..282cb28 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,4 @@ -from threading import Thread +from multiprocessing import Process import pytest @@ -7,18 +7,16 @@ from .requests.vs_api import app -# FIX: This almost always works, however a proper way to assure the server has started should be implemented. +# TODO: This always works, however a proper way to assure the server has started should be implemented. @pytest.fixture(scope="session", autouse=True) def test_server(): - thread = Thread( - target=app.run, - daemon=True, - kwargs={ - "host": "localhost", - "port": 5000, - }, - ) - thread.start() + proc = Process(target=app.run, kwargs={"host": "localhost", "port": 5000}) + proc.start() + yield + proc.kill() + proc.join() + + @pytest.fixture def anyio_backend(): return "asyncio"