mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-22 17:47:48 -06:00
fix: let make_site_icons answer --help
This commit is contained in:
1 parent
f158f1d485
commit
61547d08b3
2 files changed
+20
No files matched your search
@@ -28,12 +28,16 @@ The repository's own images come from the same shapes, in ``.github/assets/``:
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
|
||||
from core.paths import REPO_ROOT
|
||||
from sitegen.brand import write_brand
|
||||
from sitegen.chromium import require_playwright
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description=__doc__.split("\n\n")[0], allow_abbrev=False)
|
||||
parser.parse_args()
|
||||
sync_playwright = require_playwright()
|
||||
for path in write_brand(sync_playwright):
|
||||
print(path.relative_to(REPO_ROOT))
|
||||
|
||||
@@ -1012,5 +1012,21 @@ class CitedCommandsRunWhenPasted(unittest.TestCase):
|
||||
str(caught.exception))
|
||||
|
||||
|
||||
class EveryCommandReadsItsArguments(unittest.TestCase):
|
||||
"""make_site_icons.py parsed no argument: `--help` launched Chromium and
|
||||
rewrote nine committed images. A command answers its arguments or refuses
|
||||
them, never runs past them."""
|
||||
|
||||
READERS = ("ArgumentParser", "sys.argv", "scraper_cli(", "target_cli(")
|
||||
|
||||
def test_each_entry_point_reads_argv(self):
|
||||
found = [
|
||||
path.name for path in sorted((REPO_ROOT / "scripts").glob("*.py"))
|
||||
if 'if __name__ == "__main__"' in (text := path.read_text(encoding="utf-8"))
|
||||
and not any(reader in text for reader in self.READERS)
|
||||
]
|
||||
self.assertEqual(found, [])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user