Commit ed13c3f9 authored by Kirill Smelkov's avatar Kirill Smelkov

py.bench: Fix output reporting

Upstream pytest changed TerminalReporter._locationline() signature from

	def _locationline(self, collect_fspath, fspath, lineno, domain):

to

	def _locationline(self, nodeid, fspath, lineno, domain):

https://github.com/pytest-dev/pytest/commit/d73e6899 .

This way without adjusting py.bench was reporting just filenames instead
of benchmark names, e.g. this way:

(z-dev) kirr@deco:~/src/wendelin/wendelin.core$ ./t/py.bench bigfile/tests/bench_0virtmem.py
=============================================================== test session starts ===============================================================
platform linux2 -- Python 2.7.14, pytest-3.3.0, py-1.5.2, pluggy-0.6.0
rootdir: /home/kirr/src/wendelin/wendelin.core, inifile:
collected 11 items

bigfile/tests/bench_0virtmem.py                                 0.21  (0.38 0.22 0.21)
bigfile/tests/bench_0virtmem.py                                 0.23  (0.23 0.24 0.23)
bigfile/tests/bench_0virtmem.py                                 0.30  (0.30 0.30 0.30)
bigfile/tests/bench_0virtmem.py                                 0.43  (0.43 0.43 0.43)
bigfile/tests/bench_0virtmem.py                                 0.12  (0.12 0.12 0.12)
bigfile/tests/bench_0virtmem.py                                 0.08  (0.08 0.08 0.08)
bigfile/tests/bench_0virtmem.py                                 0.44  (0.44 0.44 0.44)
bigfile/tests/bench_0virtmem.py                                 0.20  (0.20 0.20 0.21)
bigfile/tests/bench_0virtmem.py                                 0.24  (0.24 0.24 0.24)
bigfile/tests/bench_0virtmem.py                                 0.30  (0.30 0.30 0.30)
bigfile/tests/bench_0virtmem.py                                 0.43  (0.43 0.43 0.43)

=========================================================== 11 passed in 12.39 seconds ============================================================

Fix it.
parent fc08766d
......@@ -158,7 +158,7 @@ class XTerminalReporter(_pytest_TerminalReporter):
# TODO ralign timing
# TODO shorter benchname?
benchname = self._locationline(report.fspath, *report.location)
benchname = self._locationline(report.nodeid, *report.location)
self._tw.line()
self._tw.write('%-*s\t' % (self.benchname_maxlen, benchname))
if report.passed:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment