Run all tests as a script (no pytest dependency).
()
| 206 | |
| 207 | |
| 208 | def main() -> int: |
| 209 | """Run all tests as a script (no pytest dependency).""" |
| 210 | import tempfile |
| 211 | import traceback |
| 212 | |
| 213 | tests = [v for k, v in globals().items() if k.startswith("test_") and callable(v)] |
| 214 | failures = 0 |
| 215 | for fn in tests: |
| 216 | with tempfile.TemporaryDirectory() as tmp: |
| 217 | try: |
| 218 | fn(Path(tmp)) |
| 219 | print(f" ok {fn.__name__}") |
| 220 | except Exception: |
| 221 | failures += 1 |
| 222 | print(f"FAIL {fn.__name__}") |
| 223 | traceback.print_exc() |
| 224 | if failures: |
| 225 | print(f"\n{failures} failure(s)") |
| 226 | return 1 |
| 227 | print(f"\n{len(tests)} passed") |
| 228 | return 0 |
| 229 | |
| 230 | |
| 231 | if __name__ == "__main__": |
no outgoing calls
no test coverage detected