Best Python code snippet using tox_python
reporter.py
Source:reporter.py
...54 def separator(self, of, msg, level):55 if self.verbosity >= level:56 self.reported_lines.append(("separator", "- summary -"))57 self.tw.sep(of, msg)58 def logline_if(self, level, of, msg, key=None, **kwargs):59 if self.verbosity >= level:60 message = str(msg) if key is None else "{}{}".format(key, msg)61 self.logline(of, message, **kwargs)62 def logline(self, of, msg, **opts):63 self.reported_lines.append((of, msg))64 timestamp = ""65 if REPORTER_TIMESTAMP_ON:66 timestamp = "{} ".format(datetime.now() - START)67 line_msg = "{}{}\n".format(timestamp, msg)68 self.tw.write(line_msg, **opts)69 def keyvalue(self, name, value):70 if name.endswith(":"):71 name += " "72 self.tw.write(name, bold=True)73 self.tw.write(value)74 self.tw.line()75 def line(self, msg, **opts):76 self.logline("line", msg, **opts)77 def info(self, msg):78 self.logline_if(Verbosity.DEBUG, "info", msg)79 def using(self, msg):80 self.logline_if(Verbosity.INFO, "using", msg, "using ", bold=True)81 def good(self, msg):82 self.logline_if(Verbosity.QUIET, "good", msg, green=True)83 def warning(self, msg):84 self.logline_if(Verbosity.QUIET, "warning", msg, "WARNING: ", red=True)85 def error(self, msg):86 self.logline_if(Verbosity.QUIET, "error", msg, "ERROR: ", red=True)87 def skip(self, msg):88 self.logline_if(Verbosity.QUIET, "skip", msg, "SKIPPED: ", yellow=True)89 def verbosity0(self, msg, **opts):90 self.logline_if(Verbosity.DEFAULT, "verbosity0", msg, **opts)91 def verbosity1(self, msg, of="verbosity1", **opts):92 self.logline_if(Verbosity.INFO, of, msg, **opts)93 def verbosity2(self, msg, **opts):94 self.logline_if(Verbosity.DEBUG, "verbosity2", msg, **opts)95 def quiet(self, msg):96 self.logline_if(Verbosity.QUIET, "quiet", msg)97_INSTANCE = Reporter()98def update_default_reporter(quiet_level, verbose_level):99 _INSTANCE.quiet_level = quiet_level100 _INSTANCE.verbose_level = verbose_level101def has_level(of):102 return _INSTANCE.verbosity > of103def verbosity():104 return _INSTANCE.verbosity105verbosity0 = _INSTANCE.verbosity0106verbosity1 = _INSTANCE.verbosity1107verbosity2 = _INSTANCE.verbosity2108error = _INSTANCE.error109warning = _INSTANCE.warning110good = _INSTANCE.good...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!