tests/semantic: standalone HERE sys.path boilerplate for 64 files (TEST-SEMANTIC-SYSPATH) #880

Closed
morodirule wants to merge 1 commit from upstream-pr/880 into main
morodirule commented 2026-11-24 14:54:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by morodirule on 2026-11-24T14:54:46Z.


Claimed in the coordination issue as: TEST-SEMANTIC-SYSPATH

Carries abnalstlll-byte's finding (46 files, now 64 on current main): tests/semantic files importing support without the HERE insertion fail with ModuleNotFoundError when run directly by path.

Change: adds the standard guarded block

HERE = os.path.dirname(os.path.abspath(file))
if HERE not in sys.path:
sys.path.insert(0, HERE)

before the first same-dir import in 64 files, adding missing import os/sys and noqa E402 to match the other 400+ files. Five files with a misplaced bare HERE after the support import (far_branch, salu64/new_ops/int_ext/misc_ext fixtures) and buffer_formats_all now use the single guarded definition (ROOT/TOOLS_DIR derivations unchanged).

Tests: full translator suite via scripts/run_semantic_tests.py: 465 files, 6108 tests, 0 failed. Direct-by-path runs: 56 files print OK, 8 runner-less files import clean with exit 0; baseline of the same form fails with ModuleNotFoundError: No module named 'support' (checked via cd tests/semantic && python3 -I test_X.py). Hardware: Linux x86-64, no GPU needed. No game files, nothing online.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5474553353 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/880). Originally posted by [morodirule](https://github.com/morodirule) on 2026-11-24T14:54:46Z. --- Claimed in the coordination issue as: TEST-SEMANTIC-SYSPATH Carries abnalstlll-byte's finding (46 files, now 64 on current main): tests/semantic files importing support without the HERE insertion fail with ModuleNotFoundError when run directly by path. Change: adds the standard guarded block HERE = os.path.dirname(os.path.abspath(__file__)) if HERE not in sys.path: sys.path.insert(0, HERE) before the first same-dir import in 64 files, adding missing import os/sys and noqa E402 to match the other 400+ files. Five files with a misplaced bare HERE after the support import (far_branch, salu64/new_ops/int_ext/misc_ext fixtures) and buffer_formats_all now use the single guarded definition (ROOT/TOOLS_DIR derivations unchanged). Tests: full translator suite via scripts/run_semantic_tests.py: 465 files, 6108 tests, 0 failed. Direct-by-path runs: 56 files print OK, 8 runner-less files import clean with exit 0; baseline of the same form fails with ModuleNotFoundError: No module named 'support' (checked via cd tests/semantic && python3 -I test_X.py). Hardware: Linux x86-64, no GPU needed. No game files, nothing online. AI-assisted.

Pull request closed

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!880
No description provided.