summaryrefslogtreecommitdiff
path: root/yarn
diff options
context:
space:
mode:
Diffstat (limited to 'yarn')
-rwxr-xr-xyarn22
1 files changed, 20 insertions, 2 deletions
diff --git a/yarn b/yarn
index ef19b94..af25d21 100755
--- a/yarn
+++ b/yarn
@@ -79,6 +79,11 @@ class YarnRunner(cliapp.Application):
['timings'],
'report wall clock time for each scenario and step')
+ self.settings.boolean(
+ ['allow-missing-steps'],
+ 'allow scenarios to reference steps that do not exist, '
+ 'by warning about them, but otherwise ignoring the scenarios')
+
def info(self, msg):
if self.settings['verbose']:
logging.info(msg)
@@ -117,7 +122,7 @@ class YarnRunner(cliapp.Application):
self.check_there_are_scenarios(scenarios)
self.check_for_duplicate_scenario_names(scenarios)
self.check_for_thens(scenarios)
- self.connect_implementations(scenarios, implementations)
+ scenarios = self.connect_implementations(scenarios, implementations)
shell_prelude = self.load_shell_libraries()
self.info('Found %d scenarios' % len(scenarios))
@@ -204,9 +209,17 @@ class YarnRunner(cliapp.Application):
''.join(' "%s"\n' % s.name for s in no_thens))
def connect_implementations(self, scenarios, implementations):
+ new_list = []
for scenario in scenarios:
+ missing_step = False
for step in scenario.steps:
- self.connect_implementation(scenario, step, implementations)
+ self.connect_implementation(
+ scenario, step, implementations)
+ if step.implementation is None:
+ missing_step = True
+ if not missing_step:
+ new_list.append(scenario)
+ return new_list
def connect_implementation(self, scenario, step, implementations):
matching = [i for i in implementations
@@ -214,6 +227,11 @@ class YarnRunner(cliapp.Application):
self.implements_matches_step(i, step)]
if len(matching) == 0:
+ if self.settings['allow-missing-steps']:
+ self.warning(
+ 'Scenario %s has missing step %s %s' %
+ (scenario.name, step.what, step.text))
+ return
raise cliapp.AppException(
'Scenario "%s", step "%s %s" has no matching '
'implementation' %