Skip to content

The agent that grows with you

test: mirror the source tree for 27 misfiled root tests; one PM home fixture

ethernetcb7c6881716e
diff --git a/.github/workflows/bootstrap-installer.yml b/.github/workflows/bootstrap-installer.yml
index 1cc5343058c..1b2dd41de41 100644
--- a/.github/workflows/bootstrap-installer.yml
+++ b/.github/workflows/bootstrap-installer.yml
@@ -123,7 +123,7 @@ jobs:
shell: bash
env:
HERMES_TEST_FILE_RETRIES: '0'
- run: bash scripts/run_tests.sh tests/test_fresh_source_install.py -q -j 1
+ run: bash scripts/run_tests.sh tests/scripts/test_fresh_source_install.py -q -j 1
windows:
name: install.ps1 protocol surface
diff --git a/.github/workflows/installer-tests.yml b/.github/workflows/installer-tests.yml
index f785ff2e8c7..1fd485841b4 100644
--- a/.github/workflows/installer-tests.yml
+++ b/.github/workflows/installer-tests.yml
@@ -56,4 +56,4 @@ jobs:
shell: bash
env:
HERMES_TEST_FILE_RETRIES: '0'
- run: bash scripts/run_tests.sh tests/test_source_launcher_stages.py -k powershell_stage -q -j 1
+ run: bash scripts/run_tests.sh tests/pm/test_source_launcher_stages.py -k powershell_stage -q -j 1
diff --git a/.github/workflows/termux-verify.yml b/.github/workflows/termux-verify.yml
index 7a55cddd9a8..e952724002e 100644
--- a/.github/workflows/termux-verify.yml
+++ b/.github/workflows/termux-verify.yml
@@ -50,13 +50,13 @@ jobs:
- name: Run the native linker and wheel contracts
run: |
bash scripts/run_tests.sh -j 2 \
- tests/test_termux_python_linkage.py tests/test_termux_retag_wheel.py \
- tests/test_termux_build_wheels.py \
- tests/test_termux_wheelhouse_cache.py tests/test_termux_runtime_libs.py \
+ tests/scripts/test_termux_python_linkage.py tests/scripts/test_termux_retag_wheel.py \
+ tests/scripts/test_termux_build_wheels.py \
+ tests/scripts/test_termux_wheelhouse_cache.py tests/scripts/test_termux_runtime_libs.py \
tests/scripts/test_archive_inputs.py \
- tests/test_termux_launchers.py tests/test_pm_bionic.py \
- tests/pm/test_stage_only.py tests/pm/test_deb_safety.py tests/test_stage_apt_repo.py \
- tests/test_run_tests_shell.py
+ tests/scripts/test_termux_launchers.py tests/pm/test_pm_bionic.py \
+ tests/pm/test_stage_only.py tests/pm/test_deb_safety.py tests/scripts/test_stage_apt_repo.py \
+ tests/scripts/test_run_tests_shell.py
tui:
name: Prebuilt TUI checks
diff --git a/scripts/gen-bootstrap-pins.py b/scripts/gen-bootstrap-pins.py
index d7bb931d550..edc7b40adea 100644
--- a/scripts/gen-bootstrap-pins.py
+++ b/scripts/gen-bootstrap-pins.py
@@ -8,7 +8,7 @@ rely on that early (no jq guarantee; python is what uv installs on Windows).
Instead, this script derives a plain-data fragment from pm/lock.json — the
SAME authority the pm package manager uses for every managed tool — and
splices it between markers in each installer. The bytes are stored, the
-truth is derived, and the drift test (tests/test_bootstrap_pins_fragment.py)
+truth is derived, and the drift test (tests/scripts/test_bootstrap_pins_fragment.py)
fails when they disagree.
Run after bumping a bootstrapped tool in pm/lock.json:
diff --git a/scripts/termux/deb_version.py b/scripts/termux/deb_version.py
index 47f8d729fe0..c3065876e5d 100644
--- a/scripts/termux/deb_version.py
+++ b/scripts/termux/deb_version.py
@@ -2,7 +2,7 @@
"""Derive a Debian package version (or channel) from a hermes-agent release tag.
Pure function; imported by scripts/termux/build_deb.sh and unit-tested by
-tests/test_termux_deb_version.py (Task 4 of .hermes/plans/2026-08-31_termux-deb.md).
+tests/scripts/test_termux_deb_version.py (Task 4 of .hermes/plans/2026-08-31_termux-deb.md).
Mapping:
v1.2.3 -> 1.2.3-1
@@ -26,7 +26,7 @@ import sys
# The canary timestamp shape MUST match the canonical _CANARY_TAG_RE in
# hermes_cli/update_channel.py (exactly 8 or 14 digits, 20-prefixed) and
# channel_for_tag in scripts/releases/r2.py. Cross-referenced by
-# tests/test_termux_deb_version.py::test_canary_tag_shape_matches_canonical.
+# tests/scripts/test_termux_deb_version.py::test_canary_tag_shape_matches_canonical.
_TAG_RE = re.compile(
r"^v(?P<major>0|[1-9]\d*)\.(?P<minor>\d+)\.(?P<patch>\d+)"
r"(?:-canary\.(?P<ts>20\d{6}(?:\d{6})?))?$"
diff --git a/tests/test_data_dir_suffix.py b/tests/hermes_cli/test_data_dir_suffix.py
similarity index 98%
rename from tests/test_data_dir_suffix.py
rename to tests/hermes_cli/test_data_dir_suffix.py
index 4f75f94f132..d4265d1f1cf 100644
--- a/tests/test_data_dir_suffix.py
+++ b/tests/hermes_cli/test_data_dir_suffix.py
@@ -39,7 +39,7 @@ print(json.dumps(result))
"""
result = subprocess.run(
[sys.executable, "-c", script], env=env,
- cwd=Path(__file__).resolve().parents[1],
+ cwd=Path(__file__).resolve().parents[2],
text=True, capture_output=True, check=True,
)
base = tmp_path / "AppData" / "Local" / "hermes" if sys.platform == "win32" else tmp_path / ".hermes"
diff --git a/tests/test_old_updater_additional_shims.py b/tests/hermes_cli/test_old_updater_additional_shims.py
similarity index 100%
rename from tests/test_old_updater_additional_shims.py
rename to tests/hermes_cli/test_old_updater_additional_shims.py
diff --git a/tests/test_old_updater_main_shims.py b/tests/hermes_cli/test_old_updater_main_shims.py
similarity index 100%
rename from tests/test_old_updater_main_shims.py
rename to tests/hermes_cli/test_old_updater_main_shims.py
diff --git a/tests/test_old_updater_shims.py b/tests/hermes_cli/test_old_updater_shims.py
similarity index 99%
rename from tests/test_old_updater_shims.py
rename to tests/hermes_cli/test_old_updater_shims.py
index b0025b26b8c..66d8a757ab5 100644
--- a/tests/test_old_updater_shims.py
+++ b/tests/hermes_cli/test_old_updater_shims.py
@@ -168,7 +168,7 @@ def test_retired_probes_and_refreshes_do_no_work(no_external_work, tmp_path):
@pytest.fixture
def old_updater():
- path = Path(__file__).parent / "compat" / "old_updater_dependencies.py"
+ path = Path(__file__).parents[1] / "compat" / "old_updater_dependencies.py"
spec = importlib.util.spec_from_file_location("old_updater_dependencies", path)
assert spec is not None and spec.loader is not None
old = importlib.util.module_from_spec(spec)
diff --git a/tests/test_plugin_historic_compat.py b/tests/hermes_cli/test_plugin_historic_compat.py
similarity index 99%
rename from tests/test_plugin_historic_compat.py
rename to tests/hermes_cli/test_plugin_historic_compat.py
index d280af07921..3e2b919924f 100644
--- a/tests/test_plugin_historic_compat.py
+++ b/tests/hermes_cli/test_plugin_historic_compat.py
@@ -107,7 +107,7 @@ plugins_transaction.recover_plugin_publication(
)
"""
return subprocess.run(
- [sys.executable, "-I", "-S", "-c", script, str(Path(__file__).resolve().parents[1]), str(project), str(journal)],
+ [sys.executable, "-I", "-S", "-c", script, str(Path(__file__).resolve().parents[2]), str(project), str(journal)],
input=json.dumps(row), text=True, capture_output=True, check=False,
env={**os.environ, "HERMES_HOME": str(Path(row["metadata"]).parent.parent)},
)
diff --git a/tests/pm/conftest.py b/tests/pm/conftest.py
new file mode 100644
index 00000000000..13135161e6f
--- /dev/null
+++ b/tests/pm/conftest.py
@@ -0,0 +1,15 @@
+"""Shared fixtures for the PM suite."""
+from pathlib import Path
+
+import pytest
+
+
+def isolated_machine_home(tmp_path, monkeypatch):
+ """Machine-scoped PM state (store, caches, profiles root) lands under tmp_path.
+
+ Opt in per module with ``pytestmark = pytest.mark.usefixtures("isolated_machine_home")``.
+ Does not cross a subprocess boundary — tests that spawn set HOME/USERPROFILE themselves.
+ """
+ monkeypatch.setattr(Path, "home", lambda: tmp_path)
+ monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
diff --git a/tests/pm/test_artifact_mirror.py b/tests/pm/test_artifact_mirror.py
index 7984ed4bcb7..bf070bbfd76 100644
--- a/tests/pm/test_artifact_mirror.py
+++ b/tests/pm/test_artifact_mirror.py
@@ -23,7 +23,7 @@ def test_cold_consumers_recover_after_upstream_removal(tmp_path, dl_server, monk
archive.writestr("tool.txt", b"pinned and preserved")
body = data.getvalue()
if mode == "library":
- from tests.test_termux_runtime_libs import _build_deb
+ from tests.scripts.test_termux_runtime_libs import _build_deb
deb = tmp_path / "test.deb"
_build_deb(deb, "libmirror.so", b"pinned and preserved")
body = deb.read_bytes()
diff --git a/tests/pm/test_install_download_control.py b/tests/pm/test_install_download_control.py
index c8405c7b5e0..c334d1e6317 100644
--- a/tests/pm/test_install_download_control.py
+++ b/tests/pm/test_install_download_control.py
@@ -8,7 +8,6 @@ import json
from functools import partial
import threading
import zipfile
-from pathlib import Path
import pytest
@@ -34,10 +33,7 @@ def archive(files: dict[str, bytes]) -> bytes:
return output.getvalue()
[email protected](autouse=True)
-def isolate_home(tmp_path, monkeypatch):
- monkeypatch.setattr(Path, "home", lambda: tmp_path)
- monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
+pytestmark = pytest.mark.usefixtures("isolated_machine_home")
@pytest.fixture(params=["install", "stage"])
diff --git a/tests/test_node_resolution.py b/tests/pm/test_node_resolution.py
similarity index 100%
rename from tests/test_node_resolution.py
rename to tests/pm/test_node_resolution.py
diff --git a/tests/test_pm_bionic.py b/tests/pm/test_pm_bionic.py
similarity index 99%
rename from tests/test_pm_bionic.py
rename to tests/pm/test_pm_bionic.py
index 318ccbeeace..f334352a032 100644
--- a/tests/test_pm_bionic.py
+++ b/tests/pm/test_pm_bionic.py
@@ -13,7 +13,7 @@ from pathlib import Path
import pytest
-REPO_ROOT = Path(__file__).resolve().parents[1]
+REPO_ROOT = Path(__file__).resolve().parents[2]
@pytest.fixture(scope="module")
diff --git a/tests/pm/test_recovery.py b/tests/pm/test_recovery.py
index ca8de22f37c..9dfde0e0553 100644
--- a/tests/pm/test_recovery.py
+++ b/tests/pm/test_recovery.py
@@ -15,10 +15,7 @@ from pm.lock import Facts
from pm.runtime import runtime_environment
from tests.pm._fixtures import _wheel
[email protected](autouse=True)
-def isolated_machine_home(tmp_path, monkeypatch):
- monkeypatch.setattr(Path, "home", lambda: tmp_path)
- monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
+pytestmark = pytest.mark.usefixtures("isolated_machine_home")
diff --git a/tests/test_source_launcher_stages.py b/tests/pm/test_source_launcher_stages.py
similarity index 99%
rename from tests/test_source_launcher_stages.py
rename to tests/pm/test_source_launcher_stages.py
index 8e3a1cb7925..d8cc5423f37 100644
--- a/tests/test_source_launcher_stages.py
+++ b/tests/pm/test_source_launcher_stages.py
@@ -11,7 +11,7 @@ from pm.environments import install_state_dir, site_packages
from pm.lock import Lockfile
from tests.hermes_cli.test_source_launcher_publication import fixture_tree
-ROOT = Path(__file__).resolve().parents[1]
+ROOT = Path(__file__).resolve().parents[2]
@pytest.mark.platforms("windows")
diff --git a/tests/pm/test_uv_cache.py b/tests/pm/test_uv_cache.py
index e9c7fcab945..34b0b149667 100644
--- a/tests/pm/test_uv_cache.py
+++ b/tests/pm/test_uv_cache.py
@@ -2,16 +2,12 @@
from __future__ import annotations
-from pathlib import Path
import pytest
import pm.packages as pkgs
[email protected](autouse=True)
-def isolated_machine_home(tmp_path, monkeypatch):
- monkeypatch.setattr(Path, "home", lambda: tmp_path)
- monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
+pytestmark = pytest.mark.usefixtures("isolated_machine_home")
diff --git a/tests/pm/test_uv_python.py b/tests/pm/test_uv_python.py
index e621c66765d..334db6042d1 100644
--- a/tests/pm/test_uv_python.py
+++ b/tests/pm/test_uv_python.py
@@ -16,10 +16,7 @@ from pm.package import InstallError
from pm.packages import Python, Uv
from pm.store import current_target
[email protected](autouse=True)
-def isolated_machine_home(tmp_path, monkeypatch):
- monkeypatch.setattr(Path, "home", lambda: tmp_path)
- monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
+pytestmark = pytest.mark.usefixtures("isolated_machine_home")
diff --git a/tests/pm/test_venv_sync_ambient_config.py b/tests/pm/test_venv_sync_ambient_config.py
index e76e61e02bc..680cf1631c4 100644
--- a/tests/pm/test_venv_sync_ambient_config.py
+++ b/tests/pm/test_venv_sync_ambient_config.py
@@ -10,10 +10,7 @@ import sys
import pytest
[email protected](autouse=True)
-def isolated_machine_home(tmp_path, monkeypatch):
- monkeypatch.setattr(Path, "home", lambda: tmp_path)
- monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
+pytestmark = pytest.mark.usefixtures("isolated_machine_home")
def test_ambient_uv_config_does_not_affect_pm_venv_sync(tmp_path, monkeypatch):
diff --git a/tests/pm/test_workspace.py b/tests/pm/test_workspace.py
index 5382373ed48..35392037520 100644
--- a/tests/pm/test_workspace.py
+++ b/tests/pm/test_workspace.py
@@ -22,10 +22,7 @@ from pm.environment import managed_environment
from tests.pm.test_environment_build import locked_project # noqa: F401
[email protected](autouse=True)
-def isolated_machine_home(tmp_path, monkeypatch):
- monkeypatch.setattr(Path, "home", lambda: tmp_path)
- monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
+pytestmark = pytest.mark.usefixtures("isolated_machine_home")
@pytest.fixture
diff --git a/tests/pm/test_workspace_build_inputs.py b/tests/pm/test_workspace_build_inputs.py
index dc2378dd7a7..b0dc4c14281 100644
--- a/tests/pm/test_workspace_build_inputs.py
+++ b/tests/pm/test_workspace_build_inputs.py
@@ -12,10 +12,7 @@ from tests.pm import _fixtures
from pm.environment import managed_environment
[email protected](autouse=True)
-def isolated_machine_home(tmp_path, monkeypatch):
- monkeypatch.setattr(Path, "home", lambda: tmp_path)
- monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
+pytestmark = pytest.mark.usefixtures("isolated_machine_home")
def _buildable_source(plugin):
diff --git a/tests/scripts/test_archive_inputs.py b/tests/scripts/test_archive_inputs.py
index df7a41a2d7f..178f784043b 100644
--- a/tests/scripts/test_archive_inputs.py
+++ b/tests/scripts/test_archive_inputs.py
@@ -13,7 +13,7 @@ from pm.downloader import HashError
from scripts.ci import archive_inputs as inputs
from scripts.releases import r2
from tests.scripts.test_release_r2 import r2_server # noqa: F401
-from tests.test_termux_runtime_libs import _Server, _build_deb
+from tests.scripts.test_termux_runtime_libs import _Server, _build_deb
def write_pins(repo, packages, libs=None):
diff --git a/tests/test_bootstrap_mirror.py b/tests/scripts/test_bootstrap_mirror.py
similarity index 99%
rename from tests/test_bootstrap_mirror.py
rename to tests/scripts/test_bootstrap_mirror.py
index ca05616eb52..2360f36e822 100644
--- a/tests/test_bootstrap_mirror.py
+++ b/tests/scripts/test_bootstrap_mirror.py
@@ -12,7 +12,7 @@ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
import pytest
-ROOT = Path(__file__).resolve().parents[1]
+ROOT = Path(__file__).resolve().parents[2]
@pytest.fixture
diff --git a/tests/test_bootstrap_pins_fragment.py b/tests/scripts/test_bootstrap_pins_fragment.py
similarity index 90%
rename from tests/test_bootstrap_pins_fragment.py
rename to tests/scripts/test_bootstrap_pins_fragment.py
index a8da1c59313..f6344fb77bb 100644
--- a/tests/test_bootstrap_pins_fragment.py
+++ b/tests/scripts/test_bootstrap_pins_fragment.py
@@ -5,7 +5,7 @@ from pathlib import Path
def test_fragments_match_the_pin_table():
- root = Path(__file__).resolve().parents[1]
+ root = Path(__file__).resolve().parents[2]
result = subprocess.run(
[sys.executable, str(root / "scripts/gen-bootstrap-pins.py"), "--check"],
cwd=root, capture_output=True, text=True, timeout=60,
diff --git a/tests/test_desktop_update_target.py b/tests/scripts/test_desktop_update_target.py
similarity index 98%
rename from tests/test_desktop_update_target.py
rename to tests/scripts/test_desktop_update_target.py
index 8a4596d3e75..14fcb1fb71d 100644
--- a/tests/test_desktop_update_target.py
+++ b/tests/scripts/test_desktop_update_target.py
@@ -14,7 +14,7 @@ import pytest
from tests.installation_launcher_fixture import publish_fixture_launcher
-SCRIPTS = Path(__file__).resolve().parents[1] / "scripts" / "desktop-update"
+SCRIPTS = Path(__file__).resolve().parents[2] / "scripts" / "desktop-update"
FAKE_CLI = """
import json
import os
@@ -23,7 +23,7 @@ import sys
def main():
if '--version' in sys.argv:
- print('Install directory: ' + os.environ.get('HANDOFF_FOREIGN', str(Path(__file__).resolve().parents[1]))); return 0
+ print('Install directory: ' + os.environ.get('HANDOFF_FOREIGN', str(Path(__file__).resolve().parents[2]))); return 0
if '--help' in sys.argv:
print('update options')
sys.exit(0)
diff --git a/tests/test_fresh_source_install.py b/tests/scripts/test_fresh_source_install.py
similarity index 99%
rename from tests/test_fresh_source_install.py
rename to tests/scripts/test_fresh_source_install.py
index 9326a2c202a..cb36afcada9 100644
--- a/tests/test_fresh_source_install.py
+++ b/tests/scripts/test_fresh_source_install.py
@@ -20,7 +20,7 @@ import pytest
from pm.store import current_target
from tests.pm._fixtures import _wheel, served as served
-ROOT = Path(__file__).resolve().parents[1]
+ROOT = Path(__file__).resolve().parents[2]
@pytest.mark.platforms("linux")
diff --git a/tests/test_icon_build_dependencies.py b/tests/scripts/test_icon_build_dependencies.py
similarity index 94%
rename from tests/test_icon_build_dependencies.py
rename to tests/scripts/test_icon_build_dependencies.py
index 9fed3a0b21b..de8de28a01e 100644
--- a/tests/test_icon_build_dependencies.py
+++ b/tests/scripts/test_icon_build_dependencies.py
@@ -6,7 +6,7 @@ from pathlib import Path
def test_icon_group_is_separate_from_runtime_extras():
- root = Path(__file__).resolve().parents[1]
+ root = Path(__file__).resolve().parents[2]
uv = shutil.which("uv")
assert uv, "uv is required for the dependency-selection contract"
diff --git a/tests/test_install_ps1_desktop_stage.py b/tests/scripts/test_install_ps1_desktop_stage.py
similarity index 99%
rename from tests/test_install_ps1_desktop_stage.py
rename to tests/scripts/test_install_ps1_desktop_stage.py
index d6ec2777315..3e5a8fd50c5 100644
--- a/tests/test_install_ps1_desktop_stage.py
+++ b/tests/scripts/test_install_ps1_desktop_stage.py
@@ -35,7 +35,7 @@ from tests.installation_launcher_fixture import publish_fixture_launcher
pytestmark = pytest.mark.platforms("windows")
-REPO_ROOT = Path(__file__).resolve().parents[1]
+REPO_ROOT = Path(__file__).resolve().parents[2]
INSTALL_PS1 = REPO_ROOT / "scripts" / "install.ps1"
_FAKE_PY = r'''
diff --git a/tests/test_install_sh_launch_handoff.py b/tests/scripts/test_install_sh_launch_handoff.py
similarity index 95%
rename from tests/test_install_sh_launch_handoff.py
rename to tests/scripts/test_install_sh_launch_handoff.py
index 2511f01cc7e..e814055e24f 100644
--- a/tests/test_install_sh_launch_handoff.py
+++ b/tests/scripts/test_install_sh_launch_handoff.py
@@ -7,7 +7,7 @@ import subprocess
import pytest
from tests.installation_launcher_fixture import publish_fixture_launcher
-ROOT = Path(__file__).resolve().parents[1]
+ROOT = Path(__file__).resolve().parents[2]
@pytest.mark.platforms('posix')
@pytest.mark.parametrize('stage, expected', [('setup', ['setup']), ('gateway', ['gateway', 'install']), ('desktop', ['desktop', '--build-only'])])
diff --git a/tests/test_install_sh_python_pin_indent.py b/tests/scripts/test_install_sh_python_pin_indent.py
similarity index 98%
rename from tests/test_install_sh_python_pin_indent.py
rename to tests/scripts/test_install_sh_python_pin_indent.py
index 5dafb729ced..da697fe1acd 100644
--- a/tests/test_install_sh_python_pin_indent.py
+++ b/tests/scripts/test_install_sh_python_pin_indent.py
@@ -14,7 +14,7 @@ import sys
import pytest
-ROOT = Path(__file__).resolve().parents[1]
+ROOT = Path(__file__).resolve().parents[2]
pytestmark = pytest.mark.platforms("posix")
diff --git a/tests/test_install_stage_frames.py b/tests/scripts/test_install_stage_frames.py
similarity index 98%
rename from tests/test_install_stage_frames.py
rename to tests/scripts/test_install_stage_frames.py
index 7c03e838e5e..6e38eb21f55 100644
--- a/tests/test_install_stage_frames.py
+++ b/tests/scripts/test_install_stage_frames.py
@@ -7,7 +7,7 @@ import subprocess
import pytest
-ROOT = Path(__file__).resolve().parents[1]
+ROOT = Path(__file__).resolve().parents[2]
SCRIPT = ROOT / "scripts" / "install.sh"
diff --git a/tests/test_powershell_script_syntax.py b/tests/scripts/test_powershell_script_syntax.py
similarity index 98%
rename from tests/test_powershell_script_syntax.py
rename to tests/scripts/test_powershell_script_syntax.py
index e5119cf75db..87ee9093053 100644
--- a/tests/test_powershell_script_syntax.py
+++ b/tests/scripts/test_powershell_script_syntax.py
@@ -21,7 +21,7 @@ from pathlib import Path
import pytest
-REPO_ROOT = Path(__file__).resolve().parent.parent
+REPO_ROOT = Path(__file__).resolve().parent.parent.parent
# Every PowerShell script a user or CI machine actually runs. Discovered,
# not hardcoded: a new script in scripts/ gets gated automatically.
diff --git a/tests/test_run_tests_shell.py b/tests/scripts/test_run_tests_shell.py
similarity index 95%
rename from tests/test_run_tests_shell.py
rename to tests/scripts/test_run_tests_shell.py
index 684f4a90a8a..82098571350 100644
--- a/tests/test_run_tests_shell.py
+++ b/tests/scripts/test_run_tests_shell.py
@@ -18,7 +18,7 @@ def test_shell_runner_executes_tests_and_propagates_failure(tmp_path):
" assert False, 'runner failure propagation canary'\n",
encoding="utf-8",
)
- root = Path(__file__).resolve().parents[1]
+ root = Path(__file__).resolve().parents[2]
result = subprocess.run(
["bash", str(root / "scripts/run_tests.sh"), "-j", "1", str(case)],
cwd=tmp_path, capture_output=True, text=True, timeout=180,
diff --git a/tests/test_stage_apt_repo.py b/tests/scripts/test_stage_apt_repo.py
similarity index 99%
rename from tests/test_stage_apt_repo.py
rename to tests/scripts/test_stage_apt_repo.py
index 2f2fd5c1ee6..a7cce91651d 100644
--- a/tests/test_stage_apt_repo.py
+++ b/tests/scripts/test_stage_apt_repo.py
@@ -16,7 +16,7 @@ from pathlib import Path
import pytest
from tests.termux_fixtures import build_deb
-REPO_ROOT = Path(__file__).resolve().parents[1]
+REPO_ROOT = Path(__file__).resolve().parents[2]
SCRIPTS = REPO_ROOT / "scripts" / "termux"
sys.path.insert(0, str(SCRIPTS))
diff --git a/tests/test_termux_build_wheels.py b/tests/scripts/test_termux_build_wheels.py
similarity index 100%
rename from tests/test_termux_build_wheels.py
rename to tests/scripts/test_termux_build_wheels.py
diff --git a/tests/test_termux_deb_version.py b/tests/scripts/test_termux_deb_version.py
similarity index 98%
rename from tests/test_termux_deb_version.py
rename to tests/scripts/test_termux_deb_version.py
index 0f861c1bf32..9e66beb44a1 100644
--- a/tests/test_termux_deb_version.py
+++ b/tests/scripts/test_termux_deb_version.py
@@ -7,7 +7,7 @@ from pathlib import Path
import pytest
from scripts.termux.deb_version import channel_for_tag, deb_version_for_tag
-SCRIPT = Path(__file__).resolve().parents[1] / "scripts/termux/deb_version.py"
+SCRIPT = Path(__file__).resolve().parents[2] / "scripts/termux/deb_version.py"
@pytest.mark.parametrize("bom", ["", "\ufeff"])
diff --git a/tests/test_termux_launchers.py b/tests/scripts/test_termux_launchers.py
similarity index 100%
rename from tests/test_termux_launchers.py
rename to tests/scripts/test_termux_launchers.py
diff --git a/tests/test_termux_python_linkage.py b/tests/scripts/test_termux_python_linkage.py
similarity index 100%
rename from tests/test_termux_python_linkage.py
rename to tests/scripts/test_termux_python_linkage.py
diff --git a/tests/test_termux_retag_wheel.py b/tests/scripts/test_termux_retag_wheel.py
similarity index 96%
rename from tests/test_termux_retag_wheel.py
rename to tests/scripts/test_termux_retag_wheel.py
index cf4cee048dd..c1ee7181e11 100644
--- a/tests/test_termux_retag_wheel.py
+++ b/tests/scripts/test_termux_retag_wheel.py
@@ -17,7 +17,7 @@ from pathlib import Path
import pytest
from tests.termux_fixtures import write_wheel, verify_record
-SCRIPTS_DIR = Path(__file__).resolve().parent.parent / "scripts" / "termux"
+SCRIPTS_DIR = Path(__file__).resolve().parent.parent.parent / "scripts" / "termux"
sys.path.insert(0, str(SCRIPTS_DIR))
import retag_wheel # noqa: E402
diff --git a/tests/test_termux_runtime_libs.py b/tests/scripts/test_termux_runtime_libs.py
similarity index 99%
rename from tests/test_termux_runtime_libs.py
rename to tests/scripts/test_termux_runtime_libs.py
index f0297b6cc18..51d94d149c9 100644
--- a/tests/test_termux_runtime_libs.py
+++ b/tests/scripts/test_termux_runtime_libs.py
@@ -17,7 +17,7 @@ from tests.termux_fixtures import build_deb
import sys
-REPO_ROOT = Path(__file__).resolve().parent.parent
+REPO_ROOT = Path(__file__).resolve().parent.parent.parent
sys.path.insert(0, str(REPO_ROOT))
sys.path.insert(0, str(REPO_ROOT / "scripts" / "termux"))
diff --git a/tests/test_termux_wheelhouse_cache.py b/tests/scripts/test_termux_wheelhouse_cache.py
similarity index 98%
rename from tests/test_termux_wheelhouse_cache.py
rename to tests/scripts/test_termux_wheelhouse_cache.py
index 91c2307e621..d9caa737284 100644
--- a/tests/test_termux_wheelhouse_cache.py
+++ b/tests/scripts/test_termux_wheelhouse_cache.py
@@ -65,7 +65,7 @@ def test_cache_rejects_incomplete_or_inconsistent_manifests(tmp_path, damage):
def test_cache_cli_keeps_commit_and_tag_provenance_distinct(tmp_path):
payload, _ = cache_tree(tmp_path)
- repo = Path(__file__).resolve().parents[1]
+ repo = Path(__file__).resolve().parents[2]
args = [sys.executable, str(repo / 'scripts/termux/wheelhouse_cache.py'), 'write',
'--payload', str(payload), '--repo', str(repo), '--builder', 'fixture-image',
'--platform-tag', 'android_24_arm64_v8a', '--python-abi', 'cp314']