summaryrefslogtreecommitdiff
path: root/yarn
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2013-06-24 07:26:11 +0100
committerLars Wirzenius <liw@liw.fi>2013-06-24 07:26:11 +0100
commit9ec5b1094362c445766e904a9b2180bed24100b4 (patch)
tree39eb3b259906824d9cb54c3840c7ad95c332b88c /yarn
parentf19995c71815be55e57fd3425a999da49471756d (diff)
downloadcmdtest-9ec5b1094362c445766e904a9b2180bed24100b4.tar.gz
Add -n and -q options
Diffstat (limited to 'yarn')
-rwxr-xr-xyarn29
1 files changed, 22 insertions, 7 deletions
diff --git a/yarn b/yarn
index fdf81a0..66f9bb7 100755
--- a/yarn
+++ b/yarn
@@ -32,12 +32,22 @@ import yarnlib
class YarnRunner(cliapp.Application):
+ def add_settings(self):
+ self.settings.boolean(
+ ['no-act', 'dry-run', 'pretend', 'n'],
+ 'do not actually run any tests, merely print what would be run')
+
+ self.settings.boolean(
+ ['quiet', 'q'],
+ 'be quiet, avoid progress reporting, only show errors')
+
def setup(self):
self.ts = ttystatus.TerminalStatus(period=0.001)
- self.ts.format(
- '%ElapsedTime() %Index(scenario,scenarios): '
- '%String(scenario_name): '
- 'step %Index(step,steps): %String(step_name)')
+ if not self.settings['quiet']:
+ self.ts.format(
+ '%ElapsedTime() %Index(scenario,scenarios): '
+ '%String(scenario_name): '
+ 'step %Index(step,steps): %String(step_name)')
def process_args(self, args):
scenarios, implementations = self.parse_scenarios(args)
@@ -61,9 +71,11 @@ class YarnRunner(cliapp.Application):
raise cliapp.AppException(
'Test suite FAILED in %s scenarios' % len(failed_scenarios))
- print (
- 'Scenario test suite PASS, with %d scenarios, in %.1f seconds' %
- (len(scenarios), duration))
+ if not self.settings['quiet']:
+ print (
+ 'Scenario test suite PASS, with %d scenarios, '
+ 'in %.1f seconds' %
+ (len(scenarios), duration))
def parse_scenarios(self, filenames):
mdparser = yarnlib.MarkdownParser()
@@ -110,6 +122,9 @@ class YarnRunner(cliapp.Application):
self.ts['scenario_name'] = scenario.name
self.ts['steps'] = scenario.steps
+ if self.settings['no-act']:
+ return True
+
datadir = tempfile.mkdtemp()
cleanup = [s for s in scenario.steps if s.what == 'FINALLY']