Skip to content

Commit

Permalink
Fix conftest.
Browse files Browse the repository at this point in the history
  • Loading branch information
janjagusch committed Oct 6, 2023
1 parent 67f0532 commit c4fecb2
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import re
import shutil
import socket
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit c4fecb2

Please sign in to comment.