Skip to content

Commit 7c04ef2

Browse files
Resolve test suite execution import errors due to path ordering (#23099)
- This has already been discussed and resolved for tests discovery in this [PR](#22454) - I have now run into the same issue for executing the test suite and have applied the same fix in this PR - Tested and working [Issue](#23098) for this current PR [Original Issue](#22453) [Original PR](#22454) Co-authored-by: Eleanor Boyd <[email protected]>
1 parent f298222 commit 7c04ef2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

python_files/unittestadapter/execution.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ def run_tests(
171171
locals: Optional[bool] = None,
172172
) -> PayloadDict:
173173
cwd = os.path.abspath(start_dir)
174+
if "/" in start_dir: # is a subdir
175+
parent_dir = os.path.dirname(start_dir)
176+
sys.path.insert(0, parent_dir)
177+
else:
178+
sys.path.insert(0, cwd)
174179
status = TestExecutionStatus.error
175180
error = None
176181
payload: PayloadDict = {"cwd": cwd, "status": status, "result": None}

0 commit comments

Comments
 (0)