Skip to content

Commit

Permalink
Add ability to run subset of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
claudep committed Dec 6, 2020
1 parent 0b8e99a commit 896f402
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,23 @@
from django.test.utils import get_runner


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


if __name__ == "__main__":
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",
Expand All @@ -39,4 +46,4 @@ def runtests(verbosity=1, failfast=False):
help="Stop running the test suite after first failed test.",
)
options = parser.parse_args()
runtests(verbosity=options.verbosity, failfast=options.failfast)
runtests(modules=options.modules, verbosity=options.verbosity, failfast=options.failfast)

0 comments on commit 896f402

Please sign in to comment.