@@ -123,6 +123,19 @@ def reportinfo(self):
123123
124124class LaunchTestModule (pytest .File ):
125125
126+ def __init__ (self , parent , * , fspath ):
127+ super ().__init__ (parent = parent , fspath = fspath )
128+
129+ @classmethod
130+ def from_parent (cls , parent , * , fspath ):
131+ """Override from_parent for compatibility."""
132+ # pytest.File.from_parent didn't exist before pytest 5.4
133+ if hasattr (super (), 'from_parent' ):
134+ instance = getattr (super (), 'from_parent' )(parent = parent , fspath = fspath )
135+ else :
136+ instance = cls (parent = parent , fspath = fspath )
137+ return instance
138+
126139 def makeitem (self , * args , ** kwargs ):
127140 return LaunchTestItem .from_parent (* args , ** kwargs )
128141
@@ -171,7 +184,7 @@ def pytest_pycollect_makemodule(path, parent):
171184def pytest_launch_collect_makemodule (path , parent , entrypoint ):
172185 marks = getattr (entrypoint , 'pytestmark' , [])
173186 if marks and any (m .name == 'launch_test' for m in marks ):
174- return LaunchTestModule ( path , parent )
187+ return LaunchTestModule . from_parent ( parent , fspath = path )
175188
176189
177190def pytest_addhooks (pluginmanager ):
0 commit comments