Index: recipe_engine/third_party/expect_tests/handle_train.py |
diff --git a/recipe_engine/third_party/expect_tests/handle_train.py b/recipe_engine/third_party/expect_tests/handle_train.py |
index b3eded73acb519106e85eb9e7f01eabde3c9a079..27747a47e7dac235af7acce5543c6674a09fabe8 100644 |
--- a/recipe_engine/third_party/expect_tests/handle_train.py |
+++ b/recipe_engine/third_party/expect_tests/handle_train.py |
@@ -9,6 +9,7 @@ import time |
from .type_definitions import DirSeen, Handler, MultiTest, Failure |
from .serialize import WriteNewData, DiffData, NonExistant, GetCurrentData |
+from .handle_test import FailChecks |
ForcedWriteAction = collections.namedtuple('ForcedWriteAction', 'test') |
@@ -66,7 +67,11 @@ class TrainHandler(Handler): |
else: |
put_next_stage(SchemaDiffWriteAction(test)) |
else: |
- put_next_stage(NoAction(test)) |
+ failed_checks = [check for check in result.checks if not check.passed] |
+ if failed_checks: |
+ put_next_stage(FailChecks(test, failed_checks)) |
+ else: |
+ put_next_stage(NoAction(test)) |
class ResultStageHandler(Handler.ResultStageHandler): |
def __init__(self, opts): |
@@ -96,6 +101,12 @@ class TrainHandler(Handler): |
def handle_DirSeen(self, dirseen): |
self.dirs_seen.add(dirseen.dir) |
+ def handle_FailChecks(self, fc): |
+ self._record_expected(fc.test, 'C') |
+ self.normal_actions.append( |
+ ('%r failed checks!\n' % fc.test.name) + fc.format(2)) |
+ return Failure() |
+ |
def handle_NoAction(self, result): |
self._record_expected(result.test, '.') |
self.verbose_actions.append('%s did not change' % result.test.name) |