18 lines
473 B
Python
18 lines
473 B
Python
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
def run_tests():
|
|
test_dir = Path(__file__).resolve().parent / "tests"
|
|
suite = unittest.defaultTestLoader.discover(str(test_dir), pattern="test_*.py")
|
|
if not suite.countTestCases():
|
|
raise RuntimeError(f"No tests found in {test_dir}")
|
|
return unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(0 if run_tests() else 1)
|