1 new commit in pytest:
https://bitbucket.org/hpk42/pytest/commits/702eec88814b/
Changeset: 702eec88814b
Branch: flake8-clean
User: RonnyPfannschmidt
Date: 2015-02-22 13:33:45+00:00
Summary: flake8 clean terminal
Affected #: 1 file
diff -r 95468cc0bb318ead1f108e9d0f15e33bfa3550c9 -r
702eec88814bac62c7a852f0b0ba3fac6cb5e98e _pytest/terminal.py
--- a/_pytest/terminal.py
+++ b/_pytest/terminal.py
@@ -10,31 +10,40 @@
def pytest_addoption(parser):
group = parser.getgroup("terminal reporting", "reporting", after="general")
- group._addoption('-v', '--verbose', action="count",
- dest="verbose", default=0, help="increase verbosity."),
- group._addoption('-q', '--quiet', action="count",
- dest="quiet", default=0, help="decrease verbosity."),
- group._addoption('-r',
- action="store", dest="reportchars", default=None, metavar="chars",
- help="show extra test summary info as specified by chars (f)ailed, "
- "(E)error, (s)skipped, (x)failed, (X)passed (w)warnings.")
- group._addoption('-l', '--showlocals',
- action="store_true", dest="showlocals", default=False,
- help="show locals in tracebacks (disabled by default).")
- group._addoption('--report',
- action="store", dest="report", default=None, metavar="opts",
- help="(deprecated, use -r)")
- group._addoption('--tb', metavar="style",
- action="store", dest="tbstyle", default='auto',
- choices=['auto', 'long', 'short', 'no', 'line', 'native'],
- help="traceback print mode (auto/long/short/line/native/no).")
- group._addoption('--fulltrace', '--full-trace',
- action="store_true", default=False,
- help="don't cut any tracebacks (default is to cut).")
- group._addoption('--color', metavar="color",
- action="store", dest="color", default='auto',
- choices=['yes', 'no', 'auto'],
- help="color terminal output (yes/no/auto).")
+ group._addoption(
+ '-v', '--verbose', action="count",
+ dest="verbose", default=0, help="increase verbosity."),
+ group._addoption(
+ '-q', '--quiet', action="count",
+ dest="quiet", default=0, help="decrease verbosity."),
+ group._addoption(
+ '-r',
+ action="store", dest="reportchars", default=None, metavar="chars",
+ help="show extra test summary info as specified by chars (f)ailed, "
+ "(E)error, (s)skipped, (x)failed, (X)passed (w)warnings.")
+ group._addoption(
+ '-l', '--showlocals',
+ action="store_true", dest="showlocals", default=False,
+ help="show locals in tracebacks (disabled by default).")
+ group._addoption(
+ '--report',
+ action="store", dest="report", default=None, metavar="opts",
+ help="(deprecated, use -r)")
+ group._addoption(
+ '--tb', metavar="style",
+ action="store", dest="tbstyle", default='auto',
+ choices=['auto', 'long', 'short', 'no', 'line', 'native'],
+ help="traceback print mode (auto/long/short/line/native/no).")
+ group._addoption(
+ '--fulltrace', '--full-trace',
+ action="store_true", default=False,
+ help="don't cut any tracebacks (default is to cut).")
+ group._addoption(
+ '--color', metavar="color",
+ action="store", dest="color", default='auto',
+ choices=['yes', 'no', 'auto'],
+ help="color terminal output (yes/no/auto).")
+
def pytest_configure(config):
config.option.verbose -= config.option.quiet
@@ -46,11 +55,13 @@
reporter.write_line("[traceconfig] " + msg)
config.trace.root.setprocessor("pytest:config", mywriter)
+
def getreportopt(config):
reportopts = ""
optvalue = config.option.report
if optvalue:
- py.builtin.print_("DEPRECATED: use -r instead of --report option.",
+ py.builtin.print_(
+ "DEPRECATED: use -r instead of --report option.",
file=sys.stderr)
if optvalue:
for setting in optvalue.split(","):
@@ -66,6 +77,7 @@
reportopts += char
return reportopts
+
def pytest_report_teststatus(report):
if report.passed:
letter = "."
@@ -77,6 +89,7 @@
letter = "f"
return report.outcome, letter, report.outcome.upper()
+
class WarningReport:
def __init__(self, code, message, nodeid=None, fslocation=None):
self.code = code
@@ -114,9 +127,9 @@
def write_fspath_result(self, fspath, res):
if fspath != self.currentfspath:
self.currentfspath = fspath
- #fspath = self.startdir.bestrelpath(fspath)
+ # fspath = self.startdir.bestrelpath(fspath)
self._tw.line()
- #relpath = self.startdir.bestrelpath(fspath)
+ # relpath = self.startdir.bestrelpath(fspath)
self._tw.write(fspath + " ")
self._tw.write(res)
@@ -208,15 +221,15 @@
word, markup = word
else:
if rep.passed:
- markup = {'green':True}
+ markup = {'green': True}
elif rep.failed:
- markup = {'red':True}
+ markup = {'red': True}
elif rep.skipped:
- markup = {'yellow':True}
+ markup = {'yellow': True}
line = self._locationline(str(rep.fspath), *rep.location)
if not hasattr(rep, 'node'):
self.write_ensure_prefix(line, word, **markup)
- #self._tw.write(word, **markup)
+ # self._tw.write(word, **markup)
else:
self.ensure_newline()
if hasattr(rep, 'node'):
@@ -237,7 +250,7 @@
items = [x for x in report.result if isinstance(x, pytest.Item)]
self._numcollected += len(items)
if self.hasmarkup:
- #self.write_fspath_result(report.fspath, 'E')
+ # self.write_fspath_result(report.fspath, 'E')
self.report_collect()
def report_collect(self, final=False):
@@ -309,7 +322,7 @@
return 0
if not self.showheader:
return
- #for i, testarg in enumerate(self.config.args):
+ # for i, testarg in enumerate(self.config.args):
# self.write_line("test path %d: %s" %(i+1, testarg))
def _printcollecteditems(self, items):
@@ -333,14 +346,14 @@
stack = []
indent = ""
for item in items:
- needed_collectors = item.listchain()[1:] # strip root node
+ needed_collectors = item.listchain()[1:] # strip root node
while stack:
if stack == needed_collectors[:len(stack)]:
break
stack.pop()
for col in needed_collectors[len(stack):]:
stack.append(col)
- #if col.name == "()":
+ # if col.name == "()":
# continue
indent = (len(stack) - 1) * " "
self._tw.line("%s%s" % (indent, col))
@@ -386,7 +399,8 @@
line = str(fspath)
if domain:
split = str(domain).split('[')
- split[0] = split[0].replace('.', '::') # don't replace '.' in
params
+ # don't replace '.' in params
+ split[0] = split[0].replace('.', '::')
line += "::" + '['.join(split)
else:
line = "[location]"
@@ -397,7 +411,7 @@
fspath, lineno, domain = rep.location
return domain
else:
- return "test session" # XXX?
+ return "test session" # XXX?
def _getcrashline(self, rep):
try:
@@ -473,13 +487,13 @@
session_duration = time.time() - self._sessionstarttime
keys = ("failed passed skipped deselected "
- "xfailed xpassed warnings").split()
+ "xfailed xpassed warnings").split()
for key in self.stats.keys():
if key not in keys:
keys.append(key)
parts = []
for key in keys:
- if key: # setup/teardown reports have an empty key, ignore them
+ if key: # setup/teardown reports have an empty key, ignore them
val = self.stats.get(key, None)
if val:
parts.append("%d %s" % (len(val), key))
@@ -510,6 +524,7 @@
self.write_sep("=", "%d tests deselected by %r" % (
len(self.stats['deselected']), " ".join(l)), bold=True)
+
def repr_pythonversion(v=None):
if v is None:
v = sys.version_info
@@ -518,6 +533,7 @@
except (TypeError, ValueError):
return str(v)
+
def flatten(l):
for x in l:
if isinstance(x, (list, tuple)):
@@ -525,4 +541,3 @@
yield y
else:
yield x
-
Repository URL: https://bitbucket.org/hpk42/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
pytest-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pytest-commit