summaryrefslogtreecommitdiff
path: root/yarn
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-10-01 19:58:20 +0300
committerLars Wirzenius <liw@liw.fi>2015-10-01 20:06:44 +0300
commit8bbd9b249ed42ed4cd778359afcce696057aa354 (patch)
tree2399d40ce38b85efa5e48f82e362ebcc99b23ae5 /yarn
parent98c463a64b6f5b46ddaa1cff21037463a50da2bd (diff)
downloadcmdtest-8bbd9b249ed42ed4cd778359afcce696057aa354.tar.gz
Flush stdout, stderr after every write
Diffstat (limited to 'yarn')
-rwxr-xr-xyarn25
1 files changed, 17 insertions, 8 deletions
diff --git a/yarn b/yarn
index faa99f6..2df0e8c 100755
--- a/yarn
+++ b/yarn
@@ -84,23 +84,31 @@ class YarnRunner(cliapp.Application):
'allow scenarios to reference steps that do not exist, '
'by warning about them, but otherwise ignoring the scenarios')
+ def stdout(self, msg):
+ self.output.write(msg)
+ self.output.flush()
+
+ def stderr(self, msg):
+ sys.stderr.write(msg)
+ sys.stderr.flush()
+
def info(self, indent, msg):
if self.settings['verbose']:
logging.info(msg)
indent_size = 4
- self.output.write('%*s%s\n' % (indent * indent_size, '', msg))
+ self.stdout('%*s%s\n' % (indent * indent_size, '', msg))
def warning(self, msg):
if self.settings['verbose']:
logging.warning(msg)
- self.output.write('WARNING: %s\n' % msg)
+ self.stdout('WARNING: %s\n' % msg)
elif not self.settings['quiet']:
self.ts.notify('WARNING: %s' % msg)
def error(self, msg):
if self.settings['verbose']:
logging.info(msg)
- sys.stderr.write('%s\n' % msg)
+ self.stderr('%s\n' % msg)
elif not self.settings['quiet']:
self.ts.error(msg)
@@ -157,14 +165,15 @@ class YarnRunner(cliapp.Application):
'Test suite FAILED in %s scenarios' % len(failed_scenarios))
if not self.settings['quiet']:
- print (
+ self.stdout(
'Scenario test suite PASS, with %d scenarios '
'(%d total steps), '
'in %.1f seconds' %
(self.scenarios_run, self.steps_run, duration))
if self.skipped_for_assuming:
- print ('Scenarios SKIPPED due to ASSUMING step failing: %d'
- % self.skipped_for_assuming)
+ self.stdout(
+ 'Scenarios SKIPPED due to ASSUMING step failing: %d'
+ % self.skipped_for_assuming)
if self.settings['timings']:
self.report_timings()
@@ -510,9 +519,9 @@ class YarnRunner(cliapp.Application):
def report_timings(self):
for scenario_name, scenario_duration, step_tuples in self.timings:
- print '%5.1f %s' % (scenario_duration, scenario_name)
+ self.stdout('%5.1f %s' % (scenario_duration, scenario_name))
for step_name, step_duration in step_tuples:
- print ' %5.1f %s' % (step_duration, step_name)
+ self.stdout(' %5.1f %s' % (step_duration, step_name))
YarnRunner(version=cmdtestlib.__version__).run()