Repository navigation
Clean up temp recordings left in OS temp dir by rec-play tests - #15162
Merged
Merged
Conversation
Nir-Az
commented
Jun 4, 2026
Nir-Az
left a comment
Collaborator
Author
There was a problem hiding this comment.
rs-agentic bot — automated code review
This review was auto-generated by the rs-agentic bot.
The PR is clean and well-motivated. Found a couple of points worth addressing (details in the inline comments).
Summary
| File | Change | Assessment |
|---|---|---|
| replaces bare | ✅ Correct pattern per guideline item 15 | |
| ✅ Correct pattern for legacy scripts — one minor concern (see inline) | ||
| Documents new rule | ✅ Clear and follows existing doc style |
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview: Two rec-play unit tests created a recording under a
tempfile.mkdtemp()directory in the OS temp dir and never deleted it, so the folders accumulated in%TEMP%on Windows across runs. This switches them to auto-cleaned temp handling and documents the rule.Tracked on [RSDSO-21593]
Summary
unit-tests/live/rec-play/pytest-record-and-stream.py— use pytest'stmp_pathfixture (auto-cleaned, self-pruning) instead oftempfile.mkdtemp(); drop now-unusedos/tempfileimports.unit-tests/live/rec-play/test-record-software-device.py— legacy flat script (no pytest fixtures): wrap record/play intry/finallywithshutil.rmtree(temp_dir, ignore_errors=True)so the temp dir is removed even when the test fails..github/skills/pytest-infra.md— add migration-checklist item 15 + a "Writing a New Pytest Test" callout teaching thetmp_pathrule (and the legacy-script fallback) so new/migrated tests don't reintroduce the leak.Why
tempfile.mkdtemp()without cleanup leaks its directory into the OS temp dir permanently; Windows never auto-prunes%TEMP%, so these recording folders piled up on CI/dev machines.Test plan
python -m py_compileon both edited test files.pytest-record-and-stream.py—PASSED [D455-114222251272]; recording lands under pytest's auto-pruned temp base.test-record-software-device.py— passes; with%TEMP%redirected to an empty sandbox, 0 leftover entries after the run.