FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Move pytest test IDs file deletion to finally block by itaihay · Pull Request #25540 · microsoft/vscode-python · GitHub

Move pytest test IDs file deletion to finally block - #25540

Merged
Eleanor Boyd (eleanorjboyd) merged 2 commits into
microsoft:mainfrom
itaihay:main
Nov 10, 2025
Merged

Move pytest test IDs file deletion to finally block#25540
Eleanor Boyd (eleanorjboyd) merged 2 commits into
microsoft:mainfrom
itaihay:main

Conversation

Itai Hay (itaihay) commented Oct 22, 2025
edited
Loading

Copy link
Copy Markdown

If the vscode-pytest execution is wrapped and re-triggered then the deletion of the file causes the second run the fail. Deleting the file on the finally block ensures that the pytest execution will work even if re-run.

  • Move the deletion of the test IDs temp file from before pytest execution to a finally block.
  • This ensures the temp file is always cleaned up, even if pytest execution fails or an exception occurs.
  • Move ids_path initialization outside the try block so it's accessible in the finally block for cleanup.

context: #15669 #24406 (comment)

Copy link
Copy Markdown

%%

msg = "Hello World"
print(msg)

%%

msg = "Hello again"
print(msg)

If the vscode-pytest execution is wrapped and re-triggered then
the deletion of the file causes the second run the fail.
Deleting the file on the finally block ensures that the pytest
execution will work even if re-run.

- Move the deletion of the test IDs temp file from before pytest
  execution to a `finally` block.
- This ensures the temp file is always cleaned up, even if pytest
  execution fails or an exception occurs.
- Move `ids_path` initialization outside the try block so it's
  accessible in the finally block for cleanup.
Eleanor Boyd (eleanorjboyd) added the debt Code quality issues label Nov 10, 2025
vs-code-engineering Bot added this to the November 2025 milestone Nov 10, 2025
Eleanor Boyd (eleanorjboyd) merged commit 56d3615 into microsoft:main Nov 10, 2025
47 of 48 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debt Code quality issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL