minor: use functools.partial
This commit is contained in:
parent
06029d11d3
commit
d8d835c1f5
|
@ -11,6 +11,7 @@ import collections
|
||||||
import platform
|
import platform
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
import pluggy
|
import pluggy
|
||||||
|
@ -878,7 +879,7 @@ class TerminalReporter(object):
|
||||||
if not self.reportchars:
|
if not self.reportchars:
|
||||||
return
|
return
|
||||||
|
|
||||||
def show_simple(lines, stat):
|
def show_simple(stat, lines):
|
||||||
failed = self.stats.get(stat)
|
failed = self.stats.get(stat)
|
||||||
if failed:
|
if failed:
|
||||||
config = self.config
|
config = self.config
|
||||||
|
@ -928,12 +929,6 @@ class TerminalReporter(object):
|
||||||
"%s [%d] %s: %s" % (verbose_word, num, fspath, reason)
|
"%s [%d] %s: %s" % (verbose_word, num, fspath, reason)
|
||||||
)
|
)
|
||||||
|
|
||||||
def shower(stat):
|
|
||||||
def show_(lines):
|
|
||||||
return show_simple(lines, stat)
|
|
||||||
|
|
||||||
return show_
|
|
||||||
|
|
||||||
def _get_report_str(config, report):
|
def _get_report_str(config, report):
|
||||||
_category, _short, verbose = config.hook.pytest_report_teststatus(
|
_category, _short, verbose = config.hook.pytest_report_teststatus(
|
||||||
report=report, config=config
|
report=report, config=config
|
||||||
|
@ -947,12 +942,12 @@ class TerminalReporter(object):
|
||||||
REPORTCHAR_ACTIONS = {
|
REPORTCHAR_ACTIONS = {
|
||||||
"x": show_xfailed,
|
"x": show_xfailed,
|
||||||
"X": show_xpassed,
|
"X": show_xpassed,
|
||||||
"f": shower("failed"),
|
"f": partial(show_simple, "failed"),
|
||||||
"F": shower("failed"),
|
"F": partial(show_simple, "failed"),
|
||||||
"s": show_skipped,
|
"s": show_skipped,
|
||||||
"S": show_skipped,
|
"S": show_skipped,
|
||||||
"p": shower("passed"),
|
"p": partial(show_simple, "passed"),
|
||||||
"E": shower("error"),
|
"E": partial(show_simple, "error"),
|
||||||
}
|
}
|
||||||
|
|
||||||
lines = []
|
lines = []
|
||||||
|
|
Loading…
Reference in New Issue