Skip to content

Commit 35c91a0

Browse files
committed
Keep the zipcode helper directly executable
The feature branch already routed zipcode lookup through the integrated ePost English-address surface, but the helper scripts themselves still lacked a shebang and executable mode. This follow-up locks the packaging/CLI contract with a regression test and marks both entrypoints executable so the documented helper can be invoked directly as a script. Constraint: Issue #96 requires an executable zipcode_search.py helper in both the repo script wrapper and bundled skill helper Rejected: Document python3-only invocation and leave file modes unchanged | would not satisfy the executable-helper requirement or catch future regressions Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep the wrapper and bundled helper executable together because tests assert the pair as the public entrypoints Tested: python3 -m unittest scripts.test_zipcode_search; node --test scripts/skill-docs.test.js; python3 scripts/zipcode_search.py "서울특별시 강남구 테헤란로 123"; ./scripts/zipcode_search.py "서울특별시 강남구 테헤란로 123"; npm run build; PYTHONPATH=.:scripts python3 -m unittest scripts.test_patent_search; npm run ci Not-tested: Direct execution of the bundled zipcode-search/scripts/zipcode_search.py helper against the live endpoint
1 parent 5c95e9e commit 35c91a0

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

scripts/test_zipcode_search.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import json
2+
import os
3+
from pathlib import Path
24
import unittest
35
from unittest import mock
46

@@ -82,6 +84,19 @@ def test_lookup_response_is_json_serializable(self):
8284
self.assertEqual(payload["results"][0]["zip_code"], "06133")
8385
self.assertIn("Teheran-ro", payload["results"][0]["english_address"])
8486

87+
def test_helper_scripts_are_executable_python_entrypoints(self):
88+
repo_root = Path(__file__).resolve().parent.parent
89+
for helper in (
90+
repo_root / "scripts" / "zipcode_search.py",
91+
repo_root / "zipcode-search" / "scripts" / "zipcode_search.py",
92+
):
93+
with self.subTest(helper=helper):
94+
self.assertTrue(os.access(helper, os.X_OK), f"{helper} should be executable")
95+
self.assertTrue(
96+
helper.read_text(encoding="utf-8").startswith("#!/usr/bin/env python3\n"),
97+
f"{helper} should start with a Python shebang",
98+
)
99+
85100

86101
if __name__ == "__main__":
87102
unittest.main()

scripts/zipcode_search.py

100644100755
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env python3
2+
13
from __future__ import annotations
24

35
from pathlib import Path

zipcode-search/scripts/zipcode_search.py

100644100755
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env python3
2+
13
from __future__ import annotations
24

35
import argparse

0 commit comments

Comments
 (0)