Index: expect_tests/handle_list.py |
diff --git a/expect_tests/handle_list.py b/expect_tests/handle_list.py |
index da17e5d3fbf89ab430fc0be748972f8fa204ee15..2632b0f20108d5db2f854fd3492761e8f57c3001 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, FakeTest, MultiTest |
dnj
2014/09/12 17:35:37
Since FakeTest is only generated/used here, it wou
pgervais
2014/09/12 21:28:30
True, but I'd rather keep all definitions together
dnj
2014/09/12 21:35:06
I see your your point. As a counterpoint, I think
|
class ListHandler(Handler): |
@@ -14,7 +14,7 @@ class ListHandler(Handler): |
class ResultStageHandler(Handler.ResultStageHandler): |
@staticmethod |
- def handle_Test(test): |
+ def handle_FakeTest(test): |
if ListHandler.COMPLETION_LIST is not None: |
ListHandler.COMPLETION_LIST.append(test.name) |
else: |
@@ -31,3 +31,47 @@ 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): |
+ test = FakeTest(name=test.name, |
+ func_call=None, |
+ expect_dir=test.expect_dir, |
+ expect_base=test.expect_base, |
+ ext=test.ext, |
+ covers=None, |
+ breakpoints=None) |
+ |
+ elif isinstance(test, MultiTest): |
+ all_tests = [FakeTest(name=one_test.name, |
+ func_call=None, |
+ expect_dir=one_test.expect_dir, |
+ expect_base=one_test.expect_base, |
+ ext=one_test.ext, |
+ covers=None, |
+ breakpoints=None) |
+ for one_test in test.tests] |
+ |
+ test = MultiTest(name=test.name, |
+ make_ctx_call=None, |
+ destroy_ctx_call=None, |
+ tests=all_tests, |
+ atomic=test.atomic |
+ ) |
dnj
2014/09/12 17:35:37
Maybe put a TypeError guard up in case someone cre
pgervais
2014/09/12 21:28:31
Done.
|
+ |
+ put_next_stage(test) |