aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-12-20 07:03:57 +0300
committerFrederick Muriuki Muriithi2023-12-20 07:03:57 +0300
commit0aabf202fdf9f70501b350bdf63d01ba922a3ee9 (patch)
tree27436941ca30993c60fe1922bc4e110a7de58e93 /tests
parentbc3a81510aee3a35e0c923f91947ad0772ed2742 (diff)
downloadgn-uploader-0aabf202fdf9f70501b350bdf63d01ba922a3ee9.tar.gz
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/conftest.py4
1 files changed, 2 insertions, 2 deletions
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()