Skip to content

Commit

Permalink
feat: add --quiet option to test/run.py
Browse files Browse the repository at this point in the history
  • Loading branch information
joanise committed Nov 7, 2024
1 parent 65149e5 commit 17bb3c4
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions test/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def describe_suite(suite: TestSuite):
SUITES = ["all", "dev", "e2e", "prod", "api", "other"]


def run_tests(suite: str, describe: bool = False) -> bool:
def run_tests(suite: str, describe: bool = False, verbosity=3) -> bool:
"""Run the specified test suite.
Args:
Expand Down Expand Up @@ -131,18 +131,26 @@ def run_tests(suite: str, describe: bool = False) -> bool:
describe_suite(test_suite)
return True
else:
runner = TextTestRunner(verbosity=3)
runner = TextTestRunner(verbosity=verbosity)
success = runner.run(test_suite).wasSuccessful()
if not success:
LOGGER.error("Some tests failed. Please see log above.")
return success


if __name__ == "__main__":
describe = "--describe" in sys.argv
if describe:
if "--describe" in sys.argv:
describe = True
sys.argv.remove("--describe")
else:
describe = False

if "--quiet" in sys.argv:
verbosity = 1
sys.argv.remove("--quiet")
else:
verbosity = 3

result = run_tests("" if len(sys.argv) <= 1 else sys.argv[1], describe)
result = run_tests("" if len(sys.argv) <= 1 else sys.argv[1], describe, verbosity)
if not result:
sys.exit(1)

0 comments on commit 17bb3c4

Please sign in to comment.