Skip to content

Commit

Permalink
Merge pull request #320 from claudep/runtest_options
Browse files Browse the repository at this point in the history
Runtest options
  • Loading branch information
Natim committed Dec 10, 2020
2 parents 7a7fc24 + 896f402 commit f255993
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions runtests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import argparse
import os
import sys

Expand All @@ -14,13 +15,35 @@
from django.test.utils import get_runner


def runtests():
def runtests(modules=["tinymce"], verbosity=1, failfast=False):
django.setup()
TestRunner = get_runner(settings)
test_runner = TestRunner(verbosity=1, interactive=True)
failures = test_runner.run_tests(["tinymce"])
test_runner = TestRunner(interactive=True, verbosity=verbosity, failfast=failfast)
failures = test_runner.run_tests(modules)
sys.exit(bool(failures))


if __name__ == "__main__":
runtests()
parser = argparse.ArgumentParser(description="Run the django-tinymce test suite.")
parser.add_argument(
"modules",
nargs="*",
metavar="module",
help='Optional path(s) to test modules; e.g. "tinymce" or '
'"tinymce.tests.test_widgets".',
)
parser.add_argument(
"-v",
"--verbosity",
default=1,
type=int,
choices=[0, 1, 2, 3],
help="Verbosity level; 0=minimal output, 1=normal output, 2=all output",
)
parser.add_argument(
"--failfast",
action="store_true",
help="Stop running the test suite after first failed test.",
)
options = parser.parse_args()
runtests(modules=options.modules, verbosity=options.verbosity, failfast=options.failfast)

0 comments on commit f255993

Please sign in to comment.