From eb014dc52f577ca3f62d9cb4a77b49e21c4ef8bc Mon Sep 17 00:00:00 2001 From: Shane Saravia Date: Tue, 19 Mar 2024 16:33:13 -0400 Subject: [PATCH] Fix execution sys path bug --- python_files/unittestadapter/execution.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python_files/unittestadapter/execution.py b/python_files/unittestadapter/execution.py index 9394303b69a1..6b9252906477 100644 --- a/python_files/unittestadapter/execution.py +++ b/python_files/unittestadapter/execution.py @@ -171,6 +171,11 @@ def run_tests( locals: Optional[bool] = None, ) -> PayloadDict: cwd = os.path.abspath(start_dir) + if "/" in start_dir: # is a subdir + parent_dir = os.path.dirname(start_dir) + sys.path.insert(0, parent_dir) + else: + sys.path.insert(0, cwd) status = TestExecutionStatus.error error = None payload: PayloadDict = {"cwd": cwd, "status": status, "result": None}