diff --git a/_pytest/session.py b/_pytest/session.py index 97cd20576..25f4ae7e3 100644 --- a/_pytest/session.py +++ b/_pytest/session.py @@ -317,7 +317,8 @@ class Item(Node): return self._location except AttributeError: location = self.reportinfo() - location = (str(location[0]), location[1], str(location[2])) + fspath = self.session.fspath.bestrelpath(location[0]) + location = (fspath, location[1], str(location[2])) self._location = location return location diff --git a/_pytest/terminal.py b/_pytest/terminal.py index e8ddaa5d1..1fca30968 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -266,11 +266,7 @@ class TerminalReporter: def _locationline(self, collect_fspath, fspath, lineno, domain): if fspath and fspath != collect_fspath: - fspath = "%s <- %s" % ( - self.curdir.bestrelpath(py.path.local(collect_fspath)), - self.curdir.bestrelpath(py.path.local(fspath))) - elif fspath: - fspath = self.curdir.bestrelpath(py.path.local(fspath)) + fspath = "%s <- %s" % (collect_fspath, fspath) if lineno is not None: lineno += 1 if fspath and lineno and domain: