From 0aabf202fdf9f70501b350bdf63d01ba922a3ee9 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 20 Dec 2023 07:03:57 +0300 Subject: Stop relying on "GUIX_ENVIRONMENT" envvar While we run the service under GNU Guix, there is no telling where anyone else with access to the code (which is open-source) will run the application. This means we need a more dynamic way to get the paths for any commands we choose to run. --- tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/conftest.py b/tests/conftest.py index be5f9f2..d8aca81 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,7 @@ """Set up fixtures for tests""" import io import os +import shutil import socket import subprocess from contextlib import closing @@ -28,8 +29,7 @@ def redis_url(): "Fixture to launch a new redis instance and return appropriate URI" port = next(# pylint: disable=[stop-iteration-return] port for port in range(6379,65535) if not is_port_in_use(port)) - redis_path = f"{os.getenv('GUIX_ENVIRONMENT')}/bin/redis-server" - command = [redis_path, "--port", str(port)] + command = [shutil.which("redis-server"), "--port", str(port)] process = subprocess.Popen(command) # pylint: disable=[consider-using-with] yield f"redis://localhost:{port}" process.kill() -- cgit v1.2.3