diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index 2d7132259..f33e8ccd8 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -734,10 +734,10 @@ class TerminalReporter(object): return res + " " def _getfailureheadline(self, rep): - if rep.head_line: - return rep.head_line - else: - return "test session" # XXX? + head_line = rep.head_line + if head_line: + return head_line + return "test session" # XXX? def _getcrashline(self, rep): try: