[PR #10] [MERGED] tests: psocache_extract pins the temporary directory it checks against #68

Closed
opened 2026-11-26 20:16:41 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/10
Author: @wavehs
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: psocache-tempdir-test


📝 Commits (1)

  • 02b682d tests: psocache_extract pins the temporary directory it checks against

📊 Changes

1 file changed (+8 additions, -3 deletions)

View changed files

📝 tests/test_psocache_extract.py (+8 -3)

📄 Description

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.)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/10 **Author:** [@wavehs](https://github.com/wavehs) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `psocache-tempdir-test` --- ### 📝 Commits (1) - [`02b682d`](https://github.com/ubiquitarianism/leonida/commit/02b682db9c31b8a1642d8f08711c426e7ab66bd4) tests: psocache_extract pins the temporary directory it checks against ### 📊 Changes **1 file changed** (+8 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_psocache_extract.py` (+8 -3) </details> ### 📄 Description 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.) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:16:41 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#68
No description provided.