浏览代码

Improved test runner to use progressive plugin for large suites

master
David Winterbottom 13 年前
父节点
当前提交
4812af1e1a
共有 2 个文件被更改,包括 11 次插入7 次删除
  1. 9
    5
      runtests.py
  2. 2
    2
      tests/config.py

+ 9
- 5
runtests.py 查看文件

@@ -4,18 +4,16 @@ import logging
4 4
 from optparse import OptionParser
5 5
 from coverage import coverage
6 6
 
7
-# This configures the settings
8 7
 from tests.config import configure
9
-configure()
10
-
11
-from django_nose import NoseTestSuiteRunner
12 8
 
13 9
 logging.disable(logging.CRITICAL)
14 10
 
15 11
 
16 12
 def run_tests(options, *test_args):
13
+    from django_nose import NoseTestSuiteRunner
17 14
     test_runner = NoseTestSuiteRunner(verbosity=options.verbosity,
18
-                                      pdb=options.pdb)
15
+                                      pdb=options.pdb,
16
+                                      )
19 17
     if not test_args:
20 18
         test_args = ['tests']
21 19
     num_failures = test_runner.run_tests(test_args)
@@ -33,6 +31,12 @@ if __name__ == '__main__':
33 31
                       action='store_true', help="Whether to drop into PDB on failure/error")
34 32
     (options, args) = parser.parse_args()
35 33
 
34
+    # If no args, then use 'progressive' plugin to keep the screen real estate
35
+    # used down to a minimum.  Otherwise, use the spec plugin
36
+    nose_args = ['-s', '-x',
37
+                 '--with-progressive' if not args else '--with-spec']
38
+    configure(nose_args)
39
+
36 40
     if options.use_coverage:
37 41
         print 'Running tests with coverage'
38 42
         c = coverage(source=['oscar'])

+ 2
- 2
tests/config.py 查看文件

@@ -4,7 +4,7 @@ from django.conf import settings, global_settings
4 4
 from oscar import OSCAR_CORE_APPS
5 5
 
6 6
 
7
-def configure():
7
+def configure(nose_args):
8 8
     if not settings.configured:
9 9
         from oscar.defaults import OSCAR_SETTINGS
10 10
 
@@ -56,6 +56,6 @@ def configure():
56 56
             HAYSTACK_SEARCH_ENGINE='dummy',
57 57
             HAYSTACK_SITECONF = 'oscar.search_sites',
58 58
             APPEND_SLASH=True,
59
-            NOSE_ARGS=['-s', '-x', '--with-spec'],
59
+            NOSE_ARGS=nose_args,
60 60
             **OSCAR_SETTINGS
61 61
         )

正在加载...
取消
保存