@@ -74,10 +74,8 @@ def __init__(self, request):
74
74
def __repr__ (self ):
75
75
return "<TmpTestdir %r>" % (self .tmpdir ,)
76
76
77
- def Config (self , topdir = None ):
78
- if topdir is None :
79
- topdir = self .tmpdir .dirpath ()
80
- return pytestConfig (topdir = topdir )
77
+ def Config (self ):
78
+ return pytestConfig ()
81
79
82
80
def finalize (self ):
83
81
for p in self ._syspathremove :
@@ -149,16 +147,23 @@ def mkpydir(self, name):
149
147
p .ensure ("__init__.py" )
150
148
return p
151
149
150
+ def getnode (self , config , arg ):
151
+ from py ._test .session import Collection
152
+ collection = Collection (config )
153
+ return collection .getbyid (collection ._normalizearg (arg ))[0 ]
154
+
152
155
def genitems (self , colitems ):
153
- return list (self .session .genitems (colitems ))
156
+ collection = colitems [0 ].collection
157
+ result = []
158
+ collection .genitems (colitems , (), result )
159
+ return result
154
160
155
161
def inline_genitems (self , * args ):
156
162
#config = self.parseconfig(*args)
157
- config = self . parseconfig ( * args )
158
- session = config . initsession ( )
163
+ from py . _test . session import Collection
164
+ config = self . parseconfigure ( * args )
159
165
rec = self .getreportrecorder (config )
160
- colitems = [config .getnode (arg ) for arg in config .args ]
161
- items = list (session .genitems (colitems ))
166
+ items = Collection (config ).perform_collect ()
162
167
return items , rec
163
168
164
169
def runitem (self , source ):
@@ -187,11 +192,9 @@ def inline_runsource1(self, *args):
187
192
def inline_run (self , * args ):
188
193
args = ("-s" , ) + args # otherwise FD leakage
189
194
config = self .parseconfig (* args )
190
- config .pluginmanager .do_configure (config )
191
- session = config .initsession ()
192
195
reprec = self .getreportrecorder (config )
193
- colitems = config .getinitialnodes ( )
194
- session . main ( colitems )
196
+ config .pluginmanager . do_configure ( config )
197
+ config . hook . pytest_cmdline_main ( config = config )
195
198
config .pluginmanager .do_unconfigure (config )
196
199
return reprec
197
200
@@ -245,29 +248,17 @@ def getitem(self, source, funcname="test_func"):
245
248
246
249
def getitems (self , source ):
247
250
modcol = self .getmodulecol (source )
248
- return list (modcol .config .initsession ().genitems ([modcol ]))
249
- #assert item is not None, "%r item not found in module:\n%s" %(funcname, source)
250
- #return item
251
-
252
- def getfscol (self , path , configargs = ()):
253
- self .config = self .parseconfig (path , * configargs )
254
- self .session = self .config .initsession ()
255
- return self .config .getnode (path )
251
+ return self .genitems ([modcol ])
256
252
257
253
def getmodulecol (self , source , configargs = (), withinit = False ):
258
254
kw = {self .request .function .__name__ : py .code .Source (source ).strip ()}
259
255
path = self .makepyfile (** kw )
260
256
if withinit :
261
257
self .makepyfile (__init__ = "#" )
262
- self .config = self .parseconfig (path , * configargs )
263
- self .session = self .config .initsession ()
264
- #self.config.pluginmanager.do_configure(config=self.config)
265
- # XXX
266
- self .config .pluginmanager .import_plugin ("runner" )
267
- plugin = self .config .pluginmanager .getplugin ("runner" )
268
- plugin .pytest_configure (config = self .config )
269
-
270
- return self .config .getnode (path )
258
+ self .config = config = self .parseconfigure (path , * configargs )
259
+ node = self .getnode (config , path )
260
+ #config.pluginmanager.do_unconfigure(config)
261
+ return node
271
262
272
263
def popen (self , cmdargs , stdout , stderr , ** kw ):
273
264
if not hasattr (py .std , 'subprocess' ):
0 commit comments