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

Manually merged
github merged 1 commit from gh-pr/10/head into gh-pr/10/base 2026-11-26 08:40:14 +00:00
Owner

@⁠wavehs on GitHub · 2026-11-24 01:31 UTC · original
wavehs:psocache-tempdir-test → main · +8 −3 · 1 files · 1 commits · merged 2026-11-24 01:40 UTC

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.)
**@⁠wavehs** on GitHub · 2026-11-24 01:31 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/10) `wavehs:psocache-tempdir-test` → `main` · +8 −3 · 1 files · 1 commits · merged 2026-11-24 01:40 UTC 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.)
test_output_outside_the_temp_directory_is_refused expects the tool to
refuse an output path in the repository root, but the tool compares it
with the system temporary directory: a checkout under /tmp or %TEMP%
(the usual sandbox worktree) makes the repository itself 'inside', the
tool writes the cache there and the test fails with 0 != 2. Run the
tool with TMPDIR set to a fresh directory so the check holds wherever
the tree lives, and clean up the output path either way.

(cherry picked from commit 4c23e4f94d931725d26ab2381d0dbe8326e77a75)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:40:13 +00:00
github manually merged commit 02b682db9c into gh-pr/10/base 2026-11-26 08:40:14 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.