Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Unified Diff: expect_tests/type_definitions.py

Issue 560173002: Simplify objects passed to the result stage (Closed) Base URL: https://chromium.googlesource.com/infra/testing/expect_tests@subprocess
Patch Set: Fixed one line length Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « expect_tests/handle_list.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « expect_tests/handle_list.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698