def IDLEDone(self): print termstyle.yellow('running IDLEDone') self.state = self._prev_state del self._prev_state cmd = 'DONE' cmd = Command(cmd) cmd.defer = defer.Deferred() self.sendLine(cmd.command) return cmd.defer
def summarise(self, result_iter, query_string): subprocess.call(['clear']) self.found_files = [] i = 0 highlight = self.highlight_func(query_string) for filename, fullpath in result_iter: self.found_files.append(fullpath) relpath = os.path.split(fullpath)[0] explanation = '' if relpath: explanation = "(in %s)" % (relpath,) index = str(i+1).rjust(2) filename = filename.ljust(30) print " %s%s %s %s" % (yellow(index), yellow(":"), highlight(filename), black(explanation)) i += 1
def _summarize(self): """summarize all tests - the number of failures, errors and successes""" self._line(termstyle.black) self._out("%s test%s run in %0.1f seconds" % ( self.total, self._plural(self.total), time.time() - self.start_time)) if self.total > self.success: self._outln(". ") additionals = [] if self.failure > 0: additionals.append(termstyle.red("%s FAILED" % ( self.failure,))) if self.error > 0: additionals.append(termstyle.yellow("%s error%s" % ( self.error, self._plural(self.error) ))) if self.skip > 0: additionals.append(termstyle.blue("%s skipped" % ( self.skip))) self._out(', '.join(additionals)) self._out(termstyle.green(" (%s test%s passed)" % ( self.success, self._plural(self.success) ))) self._outln()
def test_report_watchstate(self): f = io.StringIO() r = TerminalReporter(watch_path=None, build_path=None, terminal=Terminal(stream=f)) r.report_watchstate( WatchState(['create'], ['delete'], ['modify'], 1.0) ) assert f.getvalue() == os.linesep.join([ termstyle.green('# CREATED create'), termstyle.yellow('# MODIFIED modify'), termstyle.red('# DELETED delete'), '### Scan time: 1.000s', ]) + os.linesep
def test_report_watchstate(self): f = io.StringIO() r = TerminalReporter( watch_path=None, build_path=None, terminal=Terminal(stream=f) ) r.report_watchstate(WatchState(["create"], ["delete"], ["modify"], 1.0)) assert ( f.getvalue() == os.linesep.join( [ termstyle.green("# CREATED create"), termstyle.yellow("# MODIFIED modify"), termstyle.red("# DELETED delete"), "### Scan time: 1.000s", ] ) + os.linesep )
def yellow(self, text): self._restoreColor() return termstyle.yellow(text)
def yellow(self, text): self._restoreColor() if self.html: return '<span style="color: rgb(225,140,0)">{}</span>'.format(text) else: return termstyle.yellow(text)