diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-01-21 21:01:53 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2014-01-21 21:01:53 +0000 |
commit | 0da0eb42be3ec77416d154336e36a2c6c19b1c6b (patch) | |
tree | fb3d0b470568e9352c23f56f1df1b1ba14446758 | |
parent | 058d1ae7730d8306242035347cacd1ca7b9787d7 (diff) | |
download | cmdtest-0da0eb42be3ec77416d154336e36a2c6c19b1c6b.tar.gz |
Add --allow-missing-steps
-rw-r--r-- | NEWS | 4 | ||||
-rwxr-xr-x | yarn | 22 |
2 files changed, 24 insertions, 2 deletions
@@ -18,6 +18,10 @@ For yarn: but don't use the user's real home directory, which is important for test environment hygiene. +* New option `--allow-missing-steps` to allow running a test suite + with some steps missing. The scenarios with missing steps will be + skipped. Suggested by Pete Fotheringham. + For cmdtest: * The `--test` (`-t`) option should now work again. Thank you @@ -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' % |