simplify _locationline helper

This commit is contained in:
holger krekel 2011-03-08 13:44:53 +01:00
parent 1a7c6ecc42
commit 55657d6c51
1 changed files with 10 additions and 10 deletions

View File

@ -335,19 +335,19 @@ class TerminalReporter:
excrepr.reprcrash.toterminal(self._tw)
def _locationline(self, collect_fspath, fspath, lineno, domain):
# collect_fspath comes from testid which has a "/"-normalized path
if fspath and fspath.replace("\\", "/") != collect_fspath:
fspath = "%s <- %s" % (collect_fspath, fspath)
if fspath:
line = str(fspath)
if lineno is not None:
lineno += 1
if fspath and lineno and domain:
line = "%(fspath)s:%(lineno)s: %(domain)s"
elif fspath and domain:
line = "%(fspath)s: %(domain)s"
elif fspath and lineno:
line = "%(fspath)s:%(lineno)s %(extrapath)s"
line += ":" + str(lineno)
if domain:
line += ": " + str(domain)
else:
line = "[nolocation]"
return line % locals() + " "
line = "[location]"
return line + " "
def _getfailureheadline(self, rep):
if hasattr(rep, 'location'):