summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorBaptiste Mispelon <bmispelon@gmail.com>2019-11-30 22:10:16 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-12-09 13:47:12 +0100
commit9e565386d3fafc8cc15d07095e50d574e5f53802 (patch)
tree230529a4e6c62c4e90e7e05f8561e4f2481fcf80 /django
parentf46452638885d89cacfca6831e0b9982c87b6527 (diff)
Fixed #27430 -- Added -b/--buffer option to DiscoverRunner.
Diffstat (limited to 'django')
-rw-r--r--django/test/runner.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/django/test/runner.py b/django/test/runner.py
index 194077d81a..ff124064db 100644
--- a/django/test/runner.py
+++ b/django/test/runner.py
@@ -434,7 +434,7 @@ class DiscoverRunner:
interactive=True, failfast=False, keepdb=False,
reverse=False, debug_mode=False, debug_sql=False, parallel=0,
tags=None, exclude_tags=None, test_name_patterns=None,
- pdb=False, **kwargs):
+ pdb=False, buffer=False, **kwargs):
self.pattern = pattern
self.top_level = top_level
@@ -451,6 +451,12 @@ class DiscoverRunner:
self.pdb = pdb
if self.pdb and self.parallel > 1:
raise ValueError('You cannot use --pdb with parallel tests; pass --parallel=1 to use it.')
+ self.buffer = buffer
+ if self.buffer and self.parallel > 1:
+ raise ValueError(
+ 'You cannot use -b/--buffer with parallel tests; pass '
+ '--parallel=1 to use it.'
+ )
self.test_name_patterns = None
if test_name_patterns:
# unittest does not export the _convert_select_pattern function
@@ -503,6 +509,10 @@ class DiscoverRunner:
'--pdb', action='store_true',
help='Runs a debugger (pdb, or ipdb if installed) on error or failure.'
)
+ parser.add_argument(
+ '-b', '--buffer', action='store_true',
+ help='Discard output from passing tests.',
+ )
if PY37:
parser.add_argument(
'-k', action='append', dest='test_name_patterns',
@@ -617,6 +627,7 @@ class DiscoverRunner:
'failfast': self.failfast,
'resultclass': self.get_resultclass(),
'verbosity': self.verbosity,
+ 'buffer': self.buffer,
}
def run_checks(self):