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

Open
opened 2026-11-26 20:21:18 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1421
Author: @thiefyzheng
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fix/test-meshalloc-syspath


📝 Commits (1)

  • 80d1424 tests: test_mesh_alloc_single_writer inserts 'tools' by file, not cwd (TEST-MESHALLOC-SYSPATH)

📊 Changes

1 file changed (+2 additions, -1 deletions)

View changed files

📝 tests/test_mesh_alloc_single_writer.py (+2 -1)

📄 Description

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.


🔄 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/1421 **Author:** [@thiefyzheng](https://github.com/thiefyzheng) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/test-meshalloc-syspath` --- ### 📝 Commits (1) - [`80d1424`](https://github.com/ubiquitarianism/leonida/commit/80d1424960533b1edba2465f8998675a07b69d05) tests: test_mesh_alloc_single_writer inserts 'tools' by __file__, not cwd (TEST-MESHALLOC-SYSPATH) ### 📊 Changes **1 file changed** (+2 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_mesh_alloc_single_writer.py` (+2 -1) </details> ### 📄 Description ## 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#1452
No description provided.