solution
This commit is contained in:
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Запуск собственных проверок лабораторной 3."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
HERE = Path(__file__).resolve().parent
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
parser = argparse.ArgumentParser(description="Собственные проверки лабораторной 3")
|
||||||
|
parser.add_argument("--base-url", default=os.environ.get("BASE_URL", "http://127.0.0.1:8080"))
|
||||||
|
arguments = parser.parse_args()
|
||||||
|
os.environ["BASE_URL"] = arguments.base_url
|
||||||
|
if str(HERE) not in sys.path:
|
||||||
|
sys.path.insert(0, str(HERE))
|
||||||
|
if hasattr(sys.stdout, "reconfigure"):
|
||||||
|
sys.stdout.reconfigure(line_buffering=True)
|
||||||
|
print("BASE_URL =", arguments.base_url, flush=True)
|
||||||
|
suite = unittest.defaultTestLoader.discover(
|
||||||
|
str(HERE), pattern="test_*.py", top_level_dir=str(HERE)
|
||||||
|
)
|
||||||
|
result = unittest.TextTestRunner(verbosity=2).run(suite)
|
||||||
|
return 0 if result.wasSuccessful() else 1
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(main())
|
||||||
Reference in New Issue
Block a user