Skip to content

Commit af3b9b0

Browse files
committed
Highlight the path of file location in error report
So that it's more obvious when we need to copy the file path.
1 parent ffb583a commit af3b9b0

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,4 @@ Trevor Bekolay
101101
Wouter van Ackooy
102102
Bernard Pratz
103103
Javier Romero
104+
Xuecong Liao

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
2.9.3.dev
22
=========
33

4+
* Highlight path of the file location in the error report.
5+
46
**Bug Fixes**
57

68
* Add an 'E' to the first line of error messages from FixtureLookupErrorRepr.

_pytest/_code/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,8 @@ def toterminal(self, tw):
723723
i = msg.find("\n")
724724
if i != -1:
725725
msg = msg[:i]
726-
tw.line("%s:%s: %s" %(self.path, self.lineno, msg))
726+
tw.write(self.path, bold=True, Red=True)
727+
tw.line(":%s: %s" % (self.lineno, msg))
727728

728729
class ReprLocals(TerminalRepr):
729730
def __init__(self, lines):

0 commit comments

Comments
 (0)