From 346b7c6be4e31005de40ce8c6ffcd4f4b501b265 Mon Sep 17 00:00:00 2001 From: Merge Bot Date: Thu, 16 Apr 2026 04:58:31 +0000 Subject: [PATCH] Merge PR #780: tests/test_shebangs.py (added) --- tests/test_shebangs.py | 53 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 tests/test_shebangs.py diff --git a/tests/test_shebangs.py b/tests/test_shebangs.py new file mode 100644 index 00000000..583f4a34 --- /dev/null +++ b/tests/test_shebangs.py @@ -0,0 +1,53 @@ +""" +Tests for #681 — Python scripts have shebangs. +""" + +import os +import unittest +from pathlib import Path + +REPO_ROOT = Path(__file__).parent.parent + +# Files mentioned in issue #681 +ISSUE_FILES = [ + "bin/glitch_patterns.py", + "bin/nostr-agent-demo.py", + "bin/soul_eval_gate.py", + "scripts/captcha_bypass_handler.py", + "scripts/diagram_meaning_extractor.py", + "scripts/visual_pr_reviewer.py", +] + + +class TestShebangs(unittest.TestCase): + def test_all_issue_files_have_shebangs(self): + """All files listed in #681 have #!/usr/bin/env python3 shebang.""" + for relpath in ISSUE_FILES: + filepath = REPO_ROOT / relpath + with self.subTest(file=relpath): + self.assertTrue(filepath.exists(), f"{relpath} not found") + with open(filepath) as f: + first_line = f.readline().strip() + self.assertEqual( + first_line, "#!/usr/bin/env python3", + f"{relpath} missing shebang, first line: {first_line}" + ) + + def test_bin_scripts_have_shebangs(self): + """All .py files in bin/ have shebangs.""" + bin_dir = REPO_ROOT / "bin" + if not bin_dir.exists(): + self.skipTest("bin/ not found") + + for filepath in bin_dir.glob("*.py"): + with self.subTest(file=filepath.name): + with open(filepath) as f: + first_line = f.readline().strip() + self.assertTrue( + first_line.startswith("#!"), + f"bin/{filepath.name} missing shebang" + ) + + +if __name__ == "__main__": + unittest.main()