Skip to content

Commit

Permalink
install dependencies from requirements file
Browse files Browse the repository at this point in the history
  • Loading branch information
Donny Wong committed May 2, 2024
1 parent 68ac5dd commit d79046c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/autotest_server/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from __future__ import annotations

import logging
import os
import sys
import shutil
Expand Down Expand Up @@ -368,12 +370,11 @@ def ignore_missing_dir_error(
if err_type == FileNotFoundError:
return
raise err_inst

logger = logging.getLogger(__name__)

def update_test_settings(user, settings_id, test_settings, file_url):
try:
settings_dir = os.path.join(TEST_SCRIPT_DIR, str(settings_id))

os.makedirs(settings_dir, exist_ok=True)
os.chmod(TEST_SCRIPT_DIR, 0o755)

Expand All @@ -396,6 +397,8 @@ def update_test_settings(user, settings_id, test_settings, file_url):
default_env = os.path.join(TEST_SCRIPT_DIR, DEFAULT_ENV_DIR)
if not os.path.isdir(default_env):
subprocess.run([sys.executable, "-m", "venv", default_env], check=True)
requirements_path = os.path.join(os.path.dirname(__file__), '../requirements.txt')
subprocess.run([f"{default_env}/bin/pip", 'install', '-r', requirements_path], check=True)
try:
tester_settings["_env"] = tester_install.create_environment(tester_settings, env_dir, default_env)
except Exception as e:
Expand Down

0 comments on commit d79046c

Please sign in to comment.