diff --git a/pytest/plugin/session.py b/pytest/plugin/session.py index 524f34c77..69de9c116 100644 --- a/pytest/plugin/session.py +++ b/pytest/plugin/session.py @@ -323,7 +323,7 @@ class FSCollector(Collector): return "." relpath = self.collection.fspath.bestrelpath(self.fspath) if os.sep != "/": - relpath = str(path).replace(os.sep, "/") + relpath = relpath.replace(os.sep, "/") return relpath class File(FSCollector):