21 lines
539 B
Python
21 lines
539 B
Python
"""Compile the contract tests, then execute unittest discovery."""
|
|
|
|
from pathlib import Path
|
|
import py_compile
|
|
import sys
|
|
import unittest
|
|
|
|
|
|
TEST_DIR = Path(__file__).resolve().parent
|
|
|
|
|
|
def main() -> int:
|
|
for test_file in sorted(TEST_DIR.glob("test_*.py")):
|
|
py_compile.compile(str(test_file), doraise=True)
|
|
suite = unittest.defaultTestLoader.discover(str(TEST_DIR), pattern="test_*.py")
|
|
return 0 if unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful() else 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|