diff --git a/_pytest/nodes.py b/_pytest/nodes.py index dfe63b220..33752064f 100644 --- a/_pytest/nodes.py +++ b/_pytest/nodes.py @@ -329,7 +329,7 @@ class FSCollector(Collector): if not nodeid: nodeid = _check_initialpaths_for_relpath(session, fspath) - if os.sep != SEP: + if nodeid and os.sep != SEP: nodeid = nodeid.replace(os.sep, SEP) super(FSCollector, self).__init__(name, parent, config, session, nodeid=nodeid, fspath=fspath)