tests: psocache_extract pins the temporary directory it checks against #10

Merged
wavehs merged 1 commit from upstream-pr/10 into main 2026-11-24 01:40:33 +00:00
wavehs commented 2026-11-24 01:31:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-24T01:31:26Z.


Claimed in the coordination issue as: none — the original project's coordination issue was lost with its repository, and this repository has no such issue yet. No open pull request touches tests/test_psocache_extract.py.

Depends on: none.

What and why

test_output_outside_the_temp_directory_is_refused expects psocache_extract.py to refuse an output path in the repository root, but the tool compares that path with the system temporary directory. A checkout that lives under /tmp or %TEMP% — the usual sandbox worktree — makes the repository itself "inside" it, the tool writes the cache there and the test fails with 0 != 2 (and leaves the file behind).

The tool is right; the test's environment is not pinned. It now runs the tool with TMPDIR set to a fresh directory, so the refusal holds wherever the tree lives, and removes the output path in a cleanup either way.

Tested

main@30daa6958, macOS 15 arm64 (Apple M3 Pro), CPython 3.15.2, CPU only, no game files, checkout under $TMPDIR:

tree tests/test_psocache_extract.py
main@30daa6958 FAILED (failures=1): 0 != 2 in test_output_outside_the_temp_directory_is_refused
this commit Ran 7 tests ... OK

compileall clean, check_no_game_data.py clean. On a checkout outside the temporary directory the old test passes and this one still does (TMPDIR is only changed for this subprocess).

AI-assisted: yes.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable: no translator change.)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5464362475 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/10). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-24T01:31:26Z. --- Claimed in the coordination issue as: none — the original project's coordination issue was lost with its repository, and this repository has no such issue yet. No open pull request touches `tests/test_psocache_extract.py`. Depends on: none. ### What and why `test_output_outside_the_temp_directory_is_refused` expects `psocache_extract.py` to refuse an output path in the repository root, but the tool compares that path with the system temporary directory. A checkout that lives under `/tmp` or `%TEMP%` — the usual sandbox worktree — makes the repository itself "inside" it, the tool writes the cache there and the test fails with `0 != 2` (and leaves the file behind). The tool is right; the test's environment is not pinned. It now runs the tool with `TMPDIR` set to a fresh directory, so the refusal holds wherever the tree lives, and removes the output path in a cleanup either way. ### Tested `main@30daa6958`, macOS 15 arm64 (Apple M3 Pro), CPython 3.15.2, CPU only, no game files, checkout under `$TMPDIR`: | tree | `tests/test_psocache_extract.py` | |---|---| | `main@30daa6958` | `FAILED (failures=1)`: `0 != 2` in `test_output_outside_the_temp_directory_is_refused` | | this commit | `Ran 7 tests ... OK` | `compileall` clean, `check_no_game_data.py` clean. On a checkout outside the temporary directory the old test passes and this one still does (TMPDIR is only changed for this subprocess). AI-assisted: yes. ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (Not applicable: no translator change.)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!10
No description provided.