Skip to content

Commit

Permalink
Resolve test suite execution import errors due to path ordering (micr…
Browse files Browse the repository at this point in the history
…osoft/vscode-python#23099)

- This has already been discussed and resolved for tests discovery in
this [PR](microsoft/vscode-python#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](microsoft/vscode-python#23098) for
this current PR

[Original
Issue](microsoft/vscode-python#22453)
[Original PR](microsoft/vscode-python#22454)

Co-authored-by: Eleanor Boyd <eleanorboyd@microsoft.com>
  • Loading branch information
shanesaravia and eleanorjboyd authored Mar 29, 2024
1 parent 6b07654 commit c7f1ac4
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit c7f1ac4

Please sign in to comment.