test(torrent_api): add unit tests
This commit is contained in:
1 parent
be8e17f398
commit
d146f18144
4 files changed
+257
No files matched your search
@@ -0,0 +1,17 @@
|
||||
#!/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)
|
||||
Reference in new issue
Block a user