From c4fecb2f300c270543e423c7e7efd1ac75cdea11 Mon Sep 17 00:00:00 2001 From: Jan-Benedikt Jagusch Date: Fri, 6 Oct 2023 09:20:11 +0200 Subject: [PATCH] Fix conftest. --- tests/conftest.py | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 577476c..5d4d48e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,4 @@ +import os import re import shutil import socket @@ -74,31 +75,31 @@ def wait_for_port(port: int, host: str = "localhost", timeout: float = 5.0): @pytest.fixture(scope="module") def start_server(): """Start the server in a separate thread""" - # path_to_quetz = f"{os.environ['MAMBA_ROOT_PREFIX']}/envs/quetz-client/bin/quetz" - # if not os.path.exists(path_to_quetz): - # path_to_quetz = str(Path.home() / "mambaforge/envs/quetz-client/bin/quetz") - - # import subprocess - - # server_process = subprocess.Popen( - # [ - # path_to_quetz, - # "run", - # "quetz_test", - # "--copy-conf", - # "tests/dev_config.toml", - # "--dev", - # "--delete", - # ] - # ) - # if server_process.poll() is not None: - # raise RuntimeError("Server process failed to start") - # wait_for_port(8000) + path_to_quetz = f"{os.environ['MAMBA_ROOT_PREFIX']}/envs/quetz-client/bin/quetz" + if not os.path.exists(path_to_quetz): + path_to_quetz = str(Path.home() / "mambaforge/envs/quetz-client/bin/quetz") + + import subprocess + + server_process = subprocess.Popen( + [ + path_to_quetz, + "run", + "quetz_test", + "--copy-conf", + "tests/dev_config.toml", + "--dev", + "--delete", + ] + ) + if server_process.poll() is not None: + raise RuntimeError("Server process failed to start") + wait_for_port(8000) yield - # server_process.terminate() - # server_process.wait() + server_process.terminate() + server_process.wait() @pytest.fixture(scope="module")