diff --git a/extensions/positron-python/python_files/unittestadapter/execution.py b/extensions/positron-python/python_files/unittestadapter/execution.py index 9394303b69a..6b925290647 100644 --- a/extensions/positron-python/python_files/unittestadapter/execution.py +++ b/extensions/positron-python/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}