[pycopia] r529 committed - Individual test case selections are now placed in one temporary suite ...

0 views
Skip to first unread message

pyc...@googlecode.com

unread,
Jan 25, 2012, 8:35:57 PM1/25/12
to pyc...@googlegroups.com
Revision: 529
Author: keith.dart
Date: Wed Jan 25 17:35:33 2012
Log: Individual test case selections are now placed in one temporary
suite instead of one per testcase.

http://code.google.com/p/pycopia/source/detail?r=529

Modified:
/trunk/QA/pycopia/QA/testrunner.py

=======================================
--- /trunk/QA/pycopia/QA/testrunner.py Tue Jul 26 15:03:48 2011
+++ /trunk/QA/pycopia/QA/testrunner.py Wed Jan 25 17:35:33 2012
@@ -103,12 +103,13 @@
May raise TestRunnerError if an object is not runnable by this test
runner.
"""
+ testcases = []
for obj in objects:
objecttype = type(obj)
if objecttype is ModuleType and hasattr(obj, "run"):
self.run_module(obj)
elif objecttype is TypeType and issubclass(obj, core.Test):
- self.run_test(obj)
+ testcases.append(obj)
elif isinstance(obj, core.TestSuite):
self.run_object(obj)
elif objecttype is type and hasattr(obj, "run"):
@@ -116,6 +117,8 @@
self.run_class(obj)
else:
warnings.warn("%r is not a runnable object." % (obj,))
+ if testcases:
+ self.run_tests(testcases)

def run_class(self, cls):
"""Run a container class inside a module.
@@ -242,6 +245,24 @@
suite.add_test(testclass, *args, **kwargs)
return self.run_object(suite)

+ def run_tests(self, testclasses):
+ """Run a list of test classes.
+
+ Runs a list of test classes. Test classes are placed in a temporary
+ TestSuite.
+
+ Arguments:
+ testclasses:
+ A list of classes that are subclasses of core.Test.
+
+ Returns:
+ The return value of the temporary TestSuite instance.
+ """
+
+ suite = core.TestSuite(self.config, name="RunTestsTempSuite")
+ suite.add_tests(testclasses)
+ return self.run_object(suite)
+
def _create_results_dir(self):
"""Make results dir, don't worry if it already exists."""
try:

Reply all
Reply to author
Forward
0 new messages