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

Closed
leonida/mandy
morodirule wants to merge 0 commits from fix/test-semantic-syspath into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

morodirule commented 2026-11-24 14:54:46 +00:00

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.

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.
Sign in to join this conversation.
No description provided.