Commit 299b2659 by Calen Pennington

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

parent e60114c7
......@@ -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),
......
......@@ -2,7 +2,6 @@
logging-clear-handlers=1
with-xunitmp=1
with-ignore-docstrings=1
with-id=1
exclude-dir=lms/envs
cms/envs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment