"""Tests the bundled scripts.""" # Standard library from pathlib import Path from subprocess import run import sys # Typing from typing import Set # Generic testing from unittest import TestCase class TestScripts(TestCase): """Tests ``pyrate/scripts/*``.""" BASE_DIR = Path(__file__).parent.parent / "scripts" EXCLUDE: Set[Path] = set() def test_invoke_help(self) -> None: """Tests that the help can be invoked, which makes sure that at least all imports work.""" for script in set(TestScripts.BASE_DIR.iterdir()) - TestScripts.EXCLUDE: if not script.name.startswith(".") and not script.name.startswith("__"): with self.subTest(script.name): run( [sys.executable, str(script), "--help"], capture_output=True, timeout=30, # Sometimes caches are generated, so this is a long timeout text=True, check=True, )