Skip to content

Commit

Permalink
add possibility to specifiy args for runtests.py
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrDlouhy committed Jan 26, 2018
1 parent 8ef8a39 commit 6a053c2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions runtests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
import sys
import os
from optparse import OptionParser

import django
from django import VERSION as django_version
Expand Down Expand Up @@ -90,18 +91,23 @@ def __getitem__(self, item):
from django.test.utils import get_runner


def runtests():
def runtests(*test_args, **kwargs):
if django_version < (1, 11):
# Try lots of ports until we find one we can use
os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = 'localhost:8099-9999'

if hasattr(django, 'setup'):
django.setup()
if not test_args:
test_args = ['scribbler', ]
TestRunner = get_runner(settings)
test_runner = TestRunner(verbosity=1, interactive=True, failfast=False)
failures = test_runner.run_tests(['scribbler', ])
failures = test_runner.run_tests(test_args)
sys.exit(failures)


if __name__ == '__main__':
runtests()
parser = OptionParser()

(options, args) = parser.parse_args()
runtests(*args)

0 comments on commit 6a053c2

Please sign in to comment.