Skip to content
This repository
Newer
Older
100755 51 lines (44 sloc) 2.26 kb
c48cd0e8 »
2012-06-08 Improved runtests
1 #!/usr/bin/env python
d0ef0ace »
2012-06-29 made runtests.py work under the ancient Python 2.5
2 from __future__ import with_statement
595d9092 »
2012-06-07 almost done with venv stuff (=tons of failing tests :D)
3 from cms.test_utils.cli import configure
1f88e199 »
2012-06-08 VIRTUALENV, F*** YEAH!
4 from cms.test_utils.tmpdir import temp_dir
595d9092 »
2012-06-07 almost done with venv stuff (=tons of failing tests :D)
5 import argparse
6 import sys
7
8
fc1306c1 »
2012-06-08 setup.py test anyone?
9 def main(test_runner='cms.test_utils.runners.NormalTestRunner', junit_output_dir='.',
60e2679e »
2012-06-08 Fixes for runtests.py to support individual test runs
10 time_tests=False, verbosity=1, failfast=False, test_labels=None):
11 if not test_labels:
12 test_labels = ['cms']
fc1306c1 »
2012-06-08 setup.py test anyone?
13 with temp_dir() as STATIC_ROOT:
14 with temp_dir() as MEDIA_ROOT:
15 configure(TEST_RUNNER=test_runner, JUNIT_OUTPUT_DIR=junit_output_dir,
16 TIME_TESTS=time_tests, ROOT_URLCONF='cms.test_utils.project.urls',
17 STATIC_ROOT=STATIC_ROOT, MEDIA_ROOT=MEDIA_ROOT)
18 from django.conf import settings
19 from django.test.utils import get_runner
20 TestRunner = get_runner(settings)
21
22 test_runner = TestRunner(verbosity=verbosity, interactive=False, failfast=failfast)
60e2679e »
2012-06-08 Fixes for runtests.py to support individual test runs
23 failures = test_runner.run_tests(test_labels)
fc1306c1 »
2012-06-08 setup.py test anyone?
24 sys.exit(failures)
25
26
27 if __name__ == '__main__':
595d9092 »
2012-06-07 almost done with venv stuff (=tons of failing tests :D)
28 parser = argparse.ArgumentParser()
29 parser.add_argument('--jenkins', action='store_true', default=False,
30 dest='jenkins')
31 parser.add_argument('--jenkins-data-dir', default='.', dest='jenkins_data_dir')
32 parser.add_argument('--coverage', action='store_true', default=False,
33 dest='coverage')
34 parser.add_argument('--failfast', action='store_true', default=False,
35 dest='failfast')
36 parser.add_argument('--verbosity', default=1)
37 parser.add_argument('--time-tests', action='store_true', default=False,
38 dest='time_tests')
60e2679e »
2012-06-08 Fixes for runtests.py to support individual test runs
39 parser.add_argument('test_labels', nargs='*')
595d9092 »
2012-06-07 almost done with venv stuff (=tons of failing tests :D)
40 args = parser.parse_args()
41 if getattr(args, 'jenkins', False):
fc1306c1 »
2012-06-08 setup.py test anyone?
42 test_runner = 'cms.test_utils.runners.JenkinsTestRunner'
595d9092 »
2012-06-07 almost done with venv stuff (=tons of failing tests :D)
43 else:
fc1306c1 »
2012-06-08 setup.py test anyone?
44 test_runner = 'cms.test_utils.runners.NormalTestRunner'
45 junit_output_dir = getattr(args, 'jenkins_data_dir', '.')
46 time_tests = getattr(args, 'time_tests', False)
60e2679e »
2012-06-08 Fixes for runtests.py to support individual test runs
47 test_labels = ['cms.%s' % label for label in args.test_labels]
fc1306c1 »
2012-06-08 setup.py test anyone?
48 main(test_runner=test_runner, junit_output_dir=junit_output_dir, time_tests=time_tests,
60e2679e »
2012-06-08 Fixes for runtests.py to support individual test runs
49 verbosity=args.verbosity, failfast=args.failfast, test_labels=test_labels)
d0ef0ace »
2012-06-29 made runtests.py work under the ancient Python 2.5
50
Something went wrong with that request. Please try again.