Allow tests to run in verbose mode and multiprocess mode (by turning off TestId mode as needed)

This commit is contained in:
Calen Pennington
2016-05-16 08:50:17 -04:00
parent e60114c716
commit 299b2659c6
2 changed files with 25 additions and 6 deletions

View File

@@ -6,6 +6,11 @@ from pavelib.utils.test import utils as test_utils
from pavelib.utils.test.suites.suite import TestSuite
from pavelib.utils.envs import Env
try:
from pygments.console import colorize
except ImportError:
colorize = lambda color, text: text
__test__ = False # do not collect
@@ -33,6 +38,7 @@ class NoseTestSuite(TestSuite):
self.test_ids = self.test_id_dir / 'noseids'
self.extra_args = kwargs.get('extra_args', '')
self.cov_args = kwargs.get('cov_args', '')
self.use_ids = True
def __enter__(self):
super(NoseTestSuite, self).__enter__()
@@ -101,6 +107,9 @@ class NoseTestSuite(TestSuite):
if self.pdb:
opts += " --pdb"
if self.use_ids:
opts += " --with-id"
return opts
@@ -116,19 +125,30 @@ class SystemTestSuite(NoseTestSuite):
self.processes = kwargs.get('processes', None)
self.randomize = kwargs.get('randomize', None)
def __enter__(self):
super(SystemTestSuite, self).__enter__()
@property
def cmd(self):
if self.processes is None:
# Use one process per core for LMS tests, and no multiprocessing
# otherwise.
self.processes = -1 if self.root == 'lms' else 0
self.processes = int(self.processes)
if self.randomize is None:
self.randomize = self.root == 'lms'
if self.processes != 0 and self.verbosity > 1:
print colorize(
'red',
"The TestId module and multiprocessing module can't be run "
"together in verbose mode. Disabling TestId for {} tests.".format(self.root)
)
self.use_ids = False
def __enter__(self):
super(SystemTestSuite, self).__enter__()
@property
def cmd(self):
cmd = [
'./manage.py', self.root, 'test',
'--verbosity={}'.format(self.verbosity),

View File

@@ -2,7 +2,6 @@
logging-clear-handlers=1
with-xunitmp=1
with-ignore-docstrings=1
with-id=1
exclude-dir=lms/envs
cms/envs