Skip to content

Commit e319060

Browse files
authored
Merge pull request #7274 from bluetech/rm-py-error
code: remove last usage of py.error
2 parents b3db440 + 2ee9088 commit e319060

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/_pytest/_code/code.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,18 +268,14 @@ def ishidden(self):
268268
return tbh
269269

270270
def __str__(self) -> str:
271-
try:
272-
fn = str(self.path)
273-
except py.error.Error:
274-
fn = "???"
275271
name = self.frame.code.name
276272
try:
277273
line = str(self.statement).lstrip()
278274
except KeyboardInterrupt:
279275
raise
280276
except BaseException:
281277
line = "???"
282-
return " File %r:%d in %s\n %s\n" % (fn, self.lineno + 1, name, line)
278+
return " File %r:%d in %s\n %s\n" % (self.path, self.lineno + 1, name, line)
283279

284280
@property
285281
def name(self) -> str:

0 commit comments

Comments
 (0)