From 31390cfa336475016f432574fa7e9a37313e210c Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Tue, 3 Oct 2023 14:27:55 +0000 Subject: [PATCH] exec_wrapper.py: `sys.path` fixup for test scripts --- scripts/exec_wrapper.py | 1 + test/test.py | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/exec_wrapper.py b/scripts/exec_wrapper.py index dccd67fd..8535e89b 100755 --- a/scripts/exec_wrapper.py +++ b/scripts/exec_wrapper.py @@ -19,6 +19,7 @@ def exec_wrapper_init(): exec_wrapper_sys.path[1] = cwd from test.overlay import get_overlay_tree_dir exec_wrapper_sys.path[0] = get_overlay_tree_dir(cwd) + exec_wrapper_sys.path.insert(2, exec_wrapper_os.path.join(cwd,'test')) else: exec_wrapper_sys.path.pop(0) diff --git a/test/test.py b/test/test.py index 73bc76e3..81ef369a 100755 --- a/test/test.py +++ b/test/test.py @@ -85,12 +85,8 @@ if sys.argv[-1] == 'clean': print(f'Removed {os.path.relpath(overlay_tree_dir)!r}') else: # overlay must be set up before importing mmgen mods! - try: - import include.test_init - repo_root = include.test_init.repo_root - except ModuleNotFoundError: # allow running under exec_wrapper - import test.include.test_init - repo_root = test.include.test_init.repo_root + import include.test_init + repo_root = include.test_init.repo_root from mmgen.common import *