diff --git a/tests/test_bench.py b/tests/test_bench.py index 9c54fa5294..1179981e61 100644 --- a/tests/test_bench.py +++ b/tests/test_bench.py @@ -1,14 +1,11 @@ """tools/bench.py: the parsers, the report table and the per-server setup (no server is started).""" -import importlib.util from pathlib import Path import tempfile import types import unittest -SPEC = importlib.util.spec_from_file_location('bench', Path(__file__).resolve().parent.parent / 'tools/bench.py') -bench = importlib.util.module_from_spec(SPEC) -SPEC.loader.exec_module(bench) +from tools import bench def args(**kw): diff --git a/tools/bench.py b/tools/bench.py index 4e7b4f8f04..0f8461213c 100644 --- a/tools/bench.py +++ b/tools/bench.py @@ -39,6 +39,11 @@ import tempfile import threading import time +try: + from . import lab +except ImportError: + import lab + ROOT = Path(__file__).resolve().parent.parent EXE = '.exe' if os.name == 'nt' else '' SERVERS = ('horizon', 'vanilla', 'pumpkin') @@ -207,8 +212,7 @@ class Server: self.lines = [] self.lock = threading.Lock() self.log = log_path.open('w', encoding='utf-8') - env = dict(os.environ, HORIZON_NO_AUDIO='1', HORIZON_HOME=str(directory / 'horizon-home'), - HORIZON_LAUNCHER_NO_SELF_UPDATE='1') + env = lab.game_env(HORIZON_HOME=directory / 'horizon-home') self.process = subprocess.Popen([str(c) for c in command], cwd=directory, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, encoding='utf-8', errors='replace', env=env)