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

Unified Diff: expect_tests/handle_list.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 | « no previous file | expect_tests/type_definitions.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: expect_tests/handle_list.py
diff --git a/expect_tests/handle_list.py b/expect_tests/handle_list.py
index da17e5d3fbf89ab430fc0be748972f8fa204ee15..317c0bbc49169ba0c2b4ae17071515e1134c5e22 100644
--- a/expect_tests/handle_list.py
+++ b/expect_tests/handle_list.py
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-from expect_tests.type_definitions import Handler
+from expect_tests.type_definitions import Handler, Test, MultiTest
class ListHandler(Handler):
@@ -14,15 +14,16 @@ class ListHandler(Handler):
class ResultStageHandler(Handler.ResultStageHandler):
@staticmethod
- def handle_Test(test):
+ def handle_TestInfo(test):
if ListHandler.COMPLETION_LIST is not None:
ListHandler.COMPLETION_LIST.append(test.name)
else:
print test.name
@staticmethod
- def handle_MultiTest(multi_test):
- print 'MultiTest(%r, atomic=%r)' % (multi_test.name, multi_test.atomic)
+ def handle_MultiTestInfo(multi_test):
+ print 'MultiTestInfo(%r, atomic=%r)' % (
+ multi_test.name, multi_test.atomic)
for test in multi_test.tests:
if ListHandler.COMPLETION_LIST is not None:
ListHandler.COMPLETION_LIST.append(test.name)
@@ -31,3 +32,27 @@ class ListHandler(Handler):
# TODO(iannucci): group tests by dir?
# TODO(iannucci): print more data about the test in verbose mode?
+
+ @classmethod
+ def gen_stage_loop(cls, _opts, tests, put_next_stage, _put_result_stage):
+ """Called in the GenStage portion of the pipeline.
+
+ @param opts: Parsed CLI options
+ @param tests:
+ Iterable of type_definitions.Test or type_definitions.MultiTest
+ objects.
+ @param put_next_stage:
+ Function to push an object to the next stage of the pipeline (RunStage).
+ Note that you should push the item you got from |tests|, not the
+ subtests, in the case that the item is a MultiTest.
+ @param put_result_stage:
+ Function to push an object to the result stage of the pipeline.
+ """
+ for test in tests:
+ if isinstance(test, (Test, MultiTest)):
+ test = test.get_info()
+
+ else:
+ raise TypeError('ListHandler.gen_stage_loop cannot handle type %s'
+ % test.__class__.__name__)
+ put_next_stage(test)
« no previous file with comments | « no previous file | expect_tests/type_definitions.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698