Index: expect_tests/type_definitions.py |
diff --git a/expect_tests/type_definitions.py b/expect_tests/type_definitions.py |
index da25f8a2535360e6fd33f50ac1a91cbd9fcb96f8..380732af64840fcc37a8e6c776ed6dd06018df0d 100644 |
--- a/expect_tests/type_definitions.py |
+++ b/expect_tests/type_definitions.py |
@@ -151,6 +151,10 @@ class FuncCall(object): |
_Test = namedtuple( |
'Test', 'name func_call expect_dir expect_base ext covers breakpoints') |
+TestInfo = namedtuple( |
+ 'TestInfo', 'name expect_dir expect_base ext') |
+ |
+ |
class Test(_Test): |
TEST_COVERS_MATCH = re.compile('.*/test/([^/]*)_test\.py$') |
@@ -245,10 +249,20 @@ class Test(_Test): |
assert tests[0] is self |
return self |
+ def get_info(self): |
+ """Strips test instance of hard-to-pickle stuff |
+ |
+ Returns a TestInfo instance. |
+ """ |
+ return TestInfo(self.name, self.expect_dir, self.expect_base, self.ext) |
+ |
_MultiTest = namedtuple( |
'MultiTest', 'name make_ctx_call destroy_ctx_call tests atomic') |
+MultiTestInfo = namedtuple('MultiTestInfo', 'name tests atomic') |
+ |
+ |
class MultiTest(_MultiTest): |
"""A wrapper around one or more Test instances. |
@@ -310,6 +324,18 @@ class MultiTest(_MultiTest): |
def expect_path(_ext=None): |
return None |
+ def get_info(self): |
+ """Strips MultiTest instance of hard-to-pickle stuff |
+ |
+ Returns a MultiTestInfo instance. |
+ """ |
+ all_tests = [test.get_restricted() for test in self.tests] |
+ test = MultiTestInfo(name=self.name, |
+ tests=all_tests, |
+ atomic=self.atomic |
+ ) |
+ return test |
+ |
class Handler(object): |
"""Handler object. |