diff --git a/pythonFiles/unittestadapter/discovery.py b/pythonFiles/unittestadapter/discovery.py index 274fb5e5e663..e8f602a22fb3 100644 --- a/pythonFiles/unittestadapter/discovery.py +++ b/pythonFiles/unittestadapter/discovery.py @@ -73,6 +73,11 @@ def discover_tests( } """ 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) payload: PayloadDict = {"cwd": cwd, "status": "success", "tests": None} tests = None error: List[str] = []