Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.
Python adbadblockandroid-tvandroid-tv-launcherapple-tvbloatware-removalclaude-codedebloatfire-tvgoogle-tvlauncherprivacysmart-tvsony-braviatclvibe-codingxiaomi
tests: skip the suites that drive tools/*.sh when there is no POSIX shell
OpenCodebe5f664ec733
diff --git a/AGENTS.md b/AGENTS.mdindex 91c4664be..d302d828d 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -115,7 +115,7 @@ use it and ends with the check to run.| Check | Command or rule ||---|---|-| Tests, as CI runs them | `python3 -m unittest discover -s tests -v` after `python3 -m venv tools/venv` and `tools/venv/bin/pip install -r tools/requirements.txt`. On `main`, CI sets `CLEANYOURTV_STRICT=1`, and its "README tables" job checks that the TV tables and counts are what `tools/gen_tables.py` writes. |+| Tests, as CI runs them | `python3 -m unittest discover -s tests -v` after `python3 -m venv tools/venv` and `tools/venv/bin/pip install -r tools/requirements.txt`. On `main`, CI sets `CLEANYOURTV_STRICT=1`, and its "README tables" job checks that the TV tables and counts are what `tools/gen_tables.py` writes. On Windows the suites that drive `tools/*.sh` report as skipped: they need a POSIX shell, and CI runs them. || Launcher, if you touched `launcher/` | JDK 17, Android SDK platform 34, build-tools 34.0.0. In `launcher/`: `./gradlew --no-daemon testReleaseUnitTest lintRelease assembleRelease`. Lint must stay at zero errors. || APK size gate | `launcher/app/build/outputs/apk/release/app-release.apk` must be under 589,824 B (576 KB). Linux: `stat -c %s`, macOS: `stat -f %z`. || README rows | A new list adds only its folder, with a `tv.json`: the TV tables, the brand line and the counts are generated after merging, so leave them alone. A theme has its row in `themes/README.md`; an add-on in `addons/README.md`. |diff --git a/tests/test_adb_exposure.py b/tests/test_adb_exposure.pyindex 99491ebde..d0cb5f2c2 100644--- a/tests/test_adb_exposure.py+++ b/tests/test_adb_exposure.py@@ -35,6 +35,8 @@ class AdbSecureWarningTest(unittest.TestCase):(repo / "debloat.txt").write_text(LIST)capture = Path(tmp) / "commands.txt"env = dict(os.environ, CAPTURE=str(capture))+ if os.name != "posix" or not shutil.which("bash"):+ raise unittest.SkipTest("disable.sh is a POSIX script; it needs bash")result = subprocess.run(["bash", str(tools / "disable.sh"), "debloat.txt"], cwd=repo,env=env, capture_output=True, text=True,stdin=subprocess.DEVNULL, timeout=60)diff --git a/tests/test_b64push_atomic.py b/tests/test_b64push_atomic.pyindex 5af066140..2392b5452 100644--- a/tests/test_b64push_atomic.py+++ b/tests/test_b64push_atomic.py@@ -50,7 +50,8 @@ class TempDirTest(unittest.TestCase):self.addCleanup(shutil.rmtree, self.base, ignore_errors=True)[email protected](shutil.which("md5sum") and shutil.which("base64"), "needs md5sum and base64")[email protected](os.name == "posix" and shutil.which("md5sum") and shutil.which("base64"),+ "the fake TV's shell is /bin/sh, and md5sum and base64 are needed")class B64PushTest(TempDirTest):"""M4 (safe replace of the remote file) and L3 (usage) in tools/b64push.py."""diff --git a/tests/test_core_packages.py b/tests/test_core_packages.pyindex 4b1913837..a1c2e62cd 100644--- a/tests/test_core_packages.py+++ b/tests/test_core_packages.py@@ -74,6 +74,8 @@ class CorePackagesTest(unittest.TestCase):self.assertEqual([], found, "core Android packages must stay enabled (#884)")def test_disable_sh_refuses_before_touching_the_tv(self):+ if os.name != "posix" or not shutil.which("bash"):+ raise unittest.SkipTest("disable.sh is a POSIX script; it needs bash")with tempfile.TemporaryDirectory() as tmp:repo = Path(tmp) / "repo"tools = repo / "tools"diff --git a/tests/test_debloat_paths.py b/tests/test_debloat_paths.pyindex ed1ee81d0..b7f88f45c 100644--- a/tests/test_debloat_paths.py+++ b/tests/test_debloat_paths.py@@ -61,6 +61,8 @@ class DebloatPathsTest(unittest.TestCase):return tools, homedef run_script(self, script_path, argument, cwd, base, home):+ if os.name != "posix" or not shutil.which("bash"):+ raise unittest.SkipTest("disable.sh and restore.sh are POSIX scripts; they need bash")capture = base / "commands.txt"# No TV_HOST, so recovery.py looks for a record that cannot exist: that is the fallback these# tests exercise. HOME is isolated so a record from a real run cannot answer instead.diff --git a/tests/test_empty_list.py b/tests/test_empty_list.pyindex 06ad136fb..c7f961687 100644--- a/tests/test_empty_list.py+++ b/tests/test_empty_list.py@@ -150,6 +150,8 @@ class EmptyListTest(unittest.TestCase):env = dict(os.environ, TV_HOST="192.168.1.50", HOME=str(self.home),FAKE_TV_STATE=str(self.state_path))if entry == "sh":+ if os.name != "posix" or not shutil.which("bash"):+ raise unittest.SkipTest("disable.sh is a POSIX script; it needs bash")argv = ["bash", str(self.tools / "disable.sh"), str(self.list_path)]else:argv = [PWSH, "-NoProfile", "-File", str(self.tools / "disable.ps1"),diff --git a/tests/test_handler_guard.py b/tests/test_handler_guard.pyindex bafb247ea..e7b4cdccf 100644--- a/tests/test_handler_guard.py+++ b/tests/test_handler_guard.py@@ -43,6 +43,8 @@ class HandlerGuardTest(unittest.TestCase):(repo / "debloat.txt").write_text(LIST)capture = Path(tmp) / "commands.txt"env = dict(os.environ, CAPTURE=str(capture), **(extra_env or {}))+ if os.name != "posix" or not shutil.which("bash"):+ raise unittest.SkipTest("disable.sh is a POSIX script; it needs bash")result = subprocess.run(["bash", str(tools / "disable.sh"), "debloat.txt"], cwd=repo,env=env, capture_output=True, text=True, stdin=subprocess.DEVNULL)self.assertEqual(result.returncode, 0, result.stderr)diff --git a/tests/test_home_guard.py b/tests/test_home_guard.pyindex f39d209fa..b14b981fe 100644--- a/tests/test_home_guard.py+++ b/tests/test_home_guard.py@@ -158,6 +158,8 @@ class HomeGuardTest(unittest.TestCase):env = dict(os.environ, TV_HOST="192.168.1.50", HOME=str(self.home),FAKE_TV_STATE=str(self.state_path), **(extra_env or {}))if entry == "sh":+ if os.name != "posix" or not shutil.which("bash"):+ raise unittest.SkipTest("disable.sh is a POSIX script; it needs bash")argv = ["bash", str(self.tools / "disable.sh"), str(list_path or self.list_path)]else:argv = [PWSH, "-NoProfile", "-File", str(self.tools / "disable.ps1"),diff --git a/tests/test_launcher_handover.py b/tests/test_launcher_handover.pyindex b794a94e2..282f9e1f8 100644--- a/tests/test_launcher_handover.py+++ b/tests/test_launcher_handover.py@@ -157,6 +157,8 @@ class HandoverTest(unittest.TestCase):env.update(TV_HOST="192.168.1.50", FAKE_TV_STATE=str(self.state_path),HOME=str(self.home), JAVA_HOME=str(self.base / "java"),ANDROID_HOME=str(self.base / "android-sdk"))+ if os.name != "posix" or not shutil.which("bash"):+ raise unittest.SkipTest("build-and-install.sh is a POSIX script; it needs bash")result = subprocess.run(["bash", str(self.launcher / "build-and-install.sh")],cwd=self.launcher, env=env, capture_output=True, text=True, timeout=180,diff --git a/tests/test_launcher_min_sdk.py b/tests/test_launcher_min_sdk.pyindex 438935027..0a6f6ad9f 100644--- a/tests/test_launcher_min_sdk.py+++ b/tests/test_launcher_min_sdk.py@@ -133,6 +133,8 @@ class MinSdkGuardTest(unittest.TestCase):env.update(TV_HOST="192.168.1.50", FAKE_TV_STATE=str(self.state_path),HOME=str(self.home), JAVA_HOME=str(self.base / "java"),ANDROID_HOME=str(self.base / "android-sdk"))+ if os.name != "posix" or not shutil.which("bash"):+ raise unittest.SkipTest("build-and-install.sh is a POSIX script; it needs bash")result = subprocess.run(["bash", str(self.launcher / "build-and-install.sh")],cwd=self.launcher, env=env, capture_output=True, text=True, timeout=180,diff --git a/tests/test_photo_sync.py b/tests/test_photo_sync.pyindex 1d54e5b73..5483ce530 100644--- a/tests/test_photo_sync.py+++ b/tests/test_photo_sync.py@@ -47,7 +47,8 @@ else:'''[email protected](shutil.which("bash"), "requires Bash")[email protected](os.name == "posix" and shutil.which("bash"),+ "sync.sh is a POSIX script; it needs bash on a POSIX system")class PhotoSyncTest(unittest.TestCase):def setUp(self):self.tmp = tempfile.TemporaryDirectory()diff --git a/tests/test_recovery_record.py b/tests/test_recovery_record.pyindex e75218195..e2c4ccde8 100644--- a/tests/test_recovery_record.py+++ b/tests/test_recovery_record.py@@ -128,6 +128,8 @@ class RecoveryRecordTest(unittest.TestCase):self.state_path.write_text(json.dumps(state))def run_script(self, script, *args):+ if os.name != "posix" or not shutil.which("bash"):+ raise unittest.SkipTest(f"{script} is a POSIX script; it needs bash")env = dict(os.environ, TV_HOST="192.168.1.50", HOME=str(self.home),FAKE_TV_STATE=str(self.state_path))return subprocess.run(diff --git a/tests/test_setupwraith_guard.py b/tests/test_setupwraith_guard.pyindex 576950f8a..84b223e2c 100644--- a/tests/test_setupwraith_guard.py+++ b/tests/test_setupwraith_guard.py@@ -39,6 +39,8 @@ class SetupwraithGuardTest(unittest.TestCase):(repo / "debloat.txt").write_text(LIST)capture = Path(tmp) / "commands.txt"env = dict(os.environ, CAPTURE=str(capture), **(extra_env or {}))+ if os.name != "posix" or not shutil.which("bash"):+ raise unittest.SkipTest("disable.sh is a POSIX script; it needs bash")# The fake tv.py reads its stdin, so an inherited terminal would leave it waiting.result = subprocess.run(["bash", str(tools / "disable.sh"), "debloat.txt"], cwd=repo,env=env, capture_output=True, text=True, stdin=subprocess.DEVNULL)diff --git a/tests/test_theme_paths.py b/tests/test_theme_paths.pyindex 65556e86f..ae020d159 100644--- a/tests/test_theme_paths.py+++ b/tests/test_theme_paths.py@@ -92,11 +92,15 @@ class ThemePathsTest(unittest.TestCase):def bash_path(self, path):"""The path as bash spells it: /tmp/... on Linux and macOS, /c/Users/... under Git Bash."""+ if os.name != "posix" or not shutil.which("bash"):+ raise unittest.SkipTest("theme.sh is a POSIX script; it needs bash")out = subprocess.run(["bash", "-c", 'cd "$1" && pwd', "_", str(path)],capture_output=True, text=True, check=True)return out.stdout.strip()def run_theme(self, tools, argument, cwd):+ if os.name != "posix" or not shutil.which("bash"):+ raise unittest.SkipTest("theme.sh is a POSIX script; it needs bash")capture = Path(cwd) / "calls.txt"env = dict(os.environ, TV_HOST="192.0.2.1", CAPTURE=str(capture))result = subprocess.run(["bash", str(tools / "theme.sh"), argument], cwd=cwd, env=env,diff --git a/tests/test_theme_push_ownership.py b/tests/test_theme_push_ownership.pyindex 0a6c33e83..8935cb52b 100644--- a/tests/test_theme_push_ownership.py+++ b/tests/test_theme_push_ownership.py@@ -130,6 +130,8 @@ class ThemePushTest(unittest.TestCase):(self.theme / "config.json").write_bytes(self.config)def run_theme(self, *args, **env):+ if os.name != "posix" or not shutil.which("bash"):+ raise unittest.SkipTest("theme.sh is a POSIX script; it needs bash")full = {k: v for k, v in os.environ.items() if k != "TV_HOST"}full.update({"TV_HOST": "192.0.2.10", "FAKE_LOG": str(self.log), "FAKE_DIR": str(self.device),"FAKE_STAGE": str(self.stage), "FAKE_CONTENT_LOG": str(self.content_log),diff --git a/tests/test_tvinput_guard.py b/tests/test_tvinput_guard.pyindex eeedc76d9..6ada937ed 100644--- a/tests/test_tvinput_guard.py+++ b/tests/test_tvinput_guard.py@@ -60,6 +60,8 @@ class TvInputGuardTest(unittest.TestCase):(repo / "debloat.txt").write_text(LIST)capture = Path(tmp) / "commands.txt"env = dict(os.environ, CAPTURE=str(capture), **(extra_env or {}))+ if os.name != "posix" or not shutil.which("bash"):+ raise unittest.SkipTest("disable.sh is a POSIX script; it needs bash")result = subprocess.run(["bash", str(tools / "disable.sh"), "debloat.txt"], cwd=repo,env=env, capture_output=True, text=True, stdin=subprocess.DEVNULL)self.assertEqual(result.returncode, 0, result.stderr)