Skip to content

Commit 24bd51b

Browse files
authored
Merge pull request #5131 from blueyed/_getfailureheadline
_getfailureheadline: get head_line property only once
2 parents 5530d3e + eb13530 commit 24bd51b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/_pytest/terminal.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -734,10 +734,10 @@ def mkrel(nodeid):
734734
return res + " "
735735

736736
def _getfailureheadline(self, rep):
737-
if rep.head_line:
738-
return rep.head_line
739-
else:
740-
return "test session" # XXX?
737+
head_line = rep.head_line
738+
if head_line:
739+
return head_line
740+
return "test session" # XXX?
741741

742742
def _getcrashline(self, rep):
743743
try:

0 commit comments

Comments
 (0)