[Pytest-commit] Issue #569: Nicer filenames in terminal reports, custom startdir? (hpk42/pytest)
issues-reply at bitbucket.org
Mon Aug 25 13:22:14 CEST 2014
New issue 569: Nicer filenames in terminal reports, custom startdir?
When testing an installed package (e.g. as in the example below via `py.test -v --pyargs foo`), the report looks super ugly containing long paths:
It would be sure nice to get something like this:
Or even this:
but it would require setting a starting folder manually somehow. I've noticed this code in `TerminalReporter` but for some reason the relpath part is commented out, so it looks like `startdir` (and the corresponding hook) is unused now?
def write_fspath_result(self, fspath, res):
if fspath != self.currentfspath:
self.currentfspath = fspath
#fspath = self.startdir.bestrelpath(fspath)
#relpath = self.startdir.bestrelpath(fspath)
self._tw.write(fspath + " ")
One idea I've had regarding file paths reporting is that if we know all paths prior to reporting (which we do), the `startdir` could be just set like so
startdir = py.path.local(os.path.commonprefix(collected_files))
and this would automatically generate nice terminal logs regardless of where the package is physically located, so no conftest hacking is required. Would it make sense to implement it as an option?
More information about the pytest-commit