simplify _locationline helper
This commit is contained in:
parent
1a7c6ecc42
commit
55657d6c51
|
@ -335,19 +335,19 @@ class TerminalReporter:
|
||||||
excrepr.reprcrash.toterminal(self._tw)
|
excrepr.reprcrash.toterminal(self._tw)
|
||||||
|
|
||||||
def _locationline(self, collect_fspath, fspath, lineno, domain):
|
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:
|
if fspath and fspath.replace("\\", "/") != collect_fspath:
|
||||||
fspath = "%s <- %s" % (collect_fspath, fspath)
|
fspath = "%s <- %s" % (collect_fspath, fspath)
|
||||||
if lineno is not None:
|
if fspath:
|
||||||
lineno += 1
|
line = str(fspath)
|
||||||
if fspath and lineno and domain:
|
if lineno is not None:
|
||||||
line = "%(fspath)s:%(lineno)s: %(domain)s"
|
lineno += 1
|
||||||
elif fspath and domain:
|
line += ":" + str(lineno)
|
||||||
line = "%(fspath)s: %(domain)s"
|
if domain:
|
||||||
elif fspath and lineno:
|
line += ": " + str(domain)
|
||||||
line = "%(fspath)s:%(lineno)s %(extrapath)s"
|
|
||||||
else:
|
else:
|
||||||
line = "[nolocation]"
|
line = "[location]"
|
||||||
return line % locals() + " "
|
return line + " "
|
||||||
|
|
||||||
def _getfailureheadline(self, rep):
|
def _getfailureheadline(self, rep):
|
||||||
if hasattr(rep, 'location'):
|
if hasattr(rep, 'location'):
|
||||||
|
|
Loading…
Reference in New Issue