tests: test_mesh_alloc_single_writer inserts 'tools' by __file__, not cwd (TEST-MESHALLOC-SYSPATH) #1421

Open
github-bot wants to merge 1 commit from github-bot/gh-1421 into main AGit
Owner

@⁠thiefyzheng on GitHub · 2026-11-24 23:50 UTC · original
thiefyzheng:fix/test-meshalloc-syspath → main · +2 −1 · 1 files · 1 commits · open

What

One line: tests/test_mesh_alloc_single_writer.py inserted 'tools' on sys.path relative to the process working directory (sys.path.insert(0, 'tools'), the only relative insert in tests/), so import rdna2spirv on the next line worked only when the cwd was the repository root. It now derives the path from __file__, the same idiom the neighbouring test files use (e.g. tests/test_f32_fuzz.py, tests/test_psin_names.py).

Claimed as TEST-MESHALLOC-SYSPATH on #14 (the finding is @⁠GTAVIB4GTAVI's, at 23:47:17Z).

Why

python -I tests/test_mesh_alloc_single_writer.py from the repo root passes, but the same command from any other cwd fails with ModuleNotFoundError: No module named 'rdna2spirv' — and it is the one ImportError in a run_semantic_tests.py tests run, because that runner starts each child with cwd=<suite folder> (scripts/run_semantic_tests.py:117).

What I ran (Linux, CPython 3.12, no GPU, synthetic only)

  • Before, current main at 364ab4eab: from the worktree root the file passes; from an unrelated cwd (/tmp, absolute path invocation) → ModuleNotFoundError: No module named 'rdna2spirv' (reproduced, quoted in the claim thread).
  • After (this branch): both cwd shapes → Ran 1 test in 0.001s ... OK; python3 -m unittest tests.test_mesh_alloc_single_writer -v also passes.
  • grep over tests/ and scripts/: no other file references this file's path behavior.
  • scripts/check_no_game_data.py exit 0.

Not run

Not run on Windows (the change has no platform-specific behavior: both sides are pure os.path); not run under CI — workflows will cover the file.

AI-assisted: a pi coding agent operated by the repo contributor ran the verification and built the single-file diff; the finding is @⁠GTAVIB4GTAVI's.

**@⁠thiefyzheng** on GitHub · 2026-11-24 23:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1421) `thiefyzheng:fix/test-meshalloc-syspath` → `main` · +2 −1 · 1 files · 1 commits · open ## What One line: `tests/test_mesh_alloc_single_writer.py` inserted `'tools'` on `sys.path` relative to the process working directory (`sys.path.insert(0, 'tools')`, the only relative insert in `tests/`), so `import rdna2spirv` on the next line worked only when the cwd was the repository root. It now derives the path from `__file__`, the same idiom the neighbouring test files use (e.g. `tests/test_f32_fuzz.py`, `tests/test_psin_names.py`). Claimed as **TEST-MESHALLOC-SYSPATH** on #14 (the finding is @⁠GTAVIB4GTAVI's, at 23:47:17Z). ## Why `python -I tests/test_mesh_alloc_single_writer.py` from the repo root passes, but the same command from any other cwd fails with `ModuleNotFoundError: No module named 'rdna2spirv'` — and it is the one `ImportError` in a `run_semantic_tests.py tests` run, because that runner starts each child with `cwd=<suite folder>` (scripts/run_semantic_tests.py:117). ## What I ran (Linux, CPython 3.12, no GPU, synthetic only) - Before, current main at `364ab4eab`: from the worktree root the file passes; from an unrelated cwd (`/tmp`, absolute path invocation) → `ModuleNotFoundError: No module named 'rdna2spirv'` (reproduced, quoted in the claim thread). - After (this branch): both cwd shapes → `Ran 1 test in 0.001s ... OK`; `python3 -m unittest tests.test_mesh_alloc_single_writer -v` also passes. - `grep` over tests/ and scripts/: no other file references this file's path behavior. - `scripts/check_no_game_data.py` exit 0. ## Not run Not run on Windows (the change has no platform-specific behavior: both sides are pure `os.path`); not run under CI — workflows will cover the file. **AI-assisted**: a pi coding agent operated by the repo contributor ran the verification and built the single-file diff; the finding is @⁠GTAVIB4GTAVI's.
Replaces the cwd-relative sys.path.insert(0, 'tools') with a path
derived from __file__, matching the idiom used by neighbouring tests
(e.g. tests/test_f32_fuzz.py). Test now runs from any cwd.

AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:50:54 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 10:34 UTC · original

Reviewed 80d1424: ran python -I tests/test_mesh_alloc_single_writer.py in the sandbox on both trees. It
passes from the repo root on both; from any other cwd it fails on main (ModuleNotFoundError) and passes
with the PR, which is the intended fix and the idiom all neighbouring tests use — this file held the last
cwd-relative 'tools' insert. The PR's test file also passes copied onto main's tree, so the SHADER-766
assertions are unchanged. No findings.
AI-assisted review.

Recommendation: Merge

**@⁠PierreEbele** on GitHub · 2026-11-25 10:34 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1421#issuecomment-7159890769) Reviewed 80d1424: ran `python -I tests/test_mesh_alloc_single_writer.py` in the sandbox on both trees. It passes from the repo root on both; from any other cwd it fails on main (ModuleNotFoundError) and passes with the PR, which is the intended fix and the idiom all neighbouring tests use — this file held the last cwd-relative 'tools' insert. The PR's test file also passes copied onto main's tree, so the SHADER-766 assertions are unchanged. No findings. AI-assisted review. **Recommendation:** Merge
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1421/head:github-bot/gh-1421'
git switch 'github-bot/gh-1421'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1421'
git switch 'github-bot/gh-1421'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1421'
git switch 'github-bot/gh-1421'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1421'
git switch 'main'
git merge --squash 'github-bot/gh-1421'
git switch 'main'
git merge --ff-only 'github-bot/gh-1421'
git switch 'main'
git merge 'github-bot/gh-1421'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.