test: define hardened Compose contract
This commit is contained in:
20
tests/run.py
Normal file
20
tests/run.py
Normal file
@@ -0,0 +1,20 @@
|
||||
"""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())
|
||||
Reference in New Issue
Block a user