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

Unified Diff: recipe_engine/third_party/expect_tests/type_definitions.py

Issue 2387763003: Add initial postprocess unit test thingy. (Closed)
Patch Set: Created 4 years, 2 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
Index: recipe_engine/third_party/expect_tests/type_definitions.py
diff --git a/recipe_engine/third_party/expect_tests/type_definitions.py b/recipe_engine/third_party/expect_tests/type_definitions.py
index 308c7aae3913ebfc3a5c1f26758c5c3a0b3a2779..648d2a0105c05ef8c1bb219286687df6834cf78e 100644
--- a/recipe_engine/third_party/expect_tests/type_definitions.py
+++ b/recipe_engine/third_party/expect_tests/type_definitions.py
@@ -16,11 +16,28 @@ from collections import namedtuple
UnknownError = namedtuple('UnknownError', 'message')
NoMatchingTestsError = namedtuple('NoMatchingTestsError', '')
-Result = namedtuple('Result', 'data')
+Result = namedtuple('Result', 'data checks')
dnj 2016/10/04 16:42:35 nit: same about namedtuple spaces etc.
iannucci 2016/10/06 22:47:11 Acknowledged.
+Result.__new__.__defaults__ = ((),) # checks defaults to empty sequence
+
GenStageError = namedtuple('GenStageError', 'error')
MultiResult = namedtuple('MultiResult', 'results')
DirSeen = namedtuple('DirSeen', 'dir')
+class Check(namedtuple(
+ 'Check', 'name code context filename lineno passed')):
dnj 2016/10/04 16:42:35 nit: (and here WRT namedtuple spaces)
iannucci 2016/10/06 22:47:11 Acknowledged.
+ def format(self, indent):
martiniss 2016/10/03 19:14:19 Maybe put an example of what this will look like w
iannucci 2016/10/06 22:47:11 added
+ ret = (' '*indent)+'%(filename)s:%(lineno)d%(name)s%(code)s' % {
+ 'filename': self.filename,
+ 'lineno': self.lineno,
+ 'name': ' - %r' % self.name if self.name else '',
+ 'code': ' - `%s`' % self.code.strip() if self.code else '',
+ }
+ if self.context:
+ ret += ':\n' + '\n'.join(
+ [(' '*indent)+' %s: %r' % i for i in self.context.iteritems()])
+ return ret
+
+
class ResultStageAbort(Exception):
pass

Powered by Google App Engine
This is Rietveld 408576698