@@ -105,6 +105,7 @@ def getcalls(self, names):
105
105
return l
106
106
107
107
def contains (self , entries ):
108
+ __tracebackhide__ = True
108
109
from py .builtin import print_
109
110
i = 0
110
111
entries = list (entries )
@@ -123,8 +124,7 @@ def contains(self, entries):
123
124
break
124
125
print_ ("NONAMEMATCH" , name , "with" , call )
125
126
else :
126
- raise AssertionError ("could not find %r in %r" % (
127
- name , self .calls [i :]))
127
+ py .test .fail ("could not find %r check %r" % (name , check ))
128
128
129
129
def popcall (self , name ):
130
130
for i , call in enumerate (self .calls ):
@@ -278,7 +278,16 @@ def mkpydir(self, name):
278
278
Collection = Collection
279
279
def getnode (self , config , arg ):
280
280
collection = Collection (config )
281
- return collection .getbyid (collection ._normalizearg (arg ))[0 ]
281
+ assert '::' not in str (arg )
282
+ p = py .path .local (arg )
283
+ x = collection .fspath .bestrelpath (p )
284
+ return collection .perform_collect ([x ], genitems = False )[0 ]
285
+
286
+ def getpathnode (self , path ):
287
+ config = self .parseconfig (path )
288
+ collection = Collection (config )
289
+ x = collection .fspath .bestrelpath (path )
290
+ return collection .perform_collect ([x ], genitems = False )[0 ]
282
291
283
292
def genitems (self , colitems ):
284
293
collection = colitems [0 ].collection
@@ -291,8 +300,9 @@ def inline_genitems(self, *args):
291
300
#config = self.parseconfig(*args)
292
301
config = self .parseconfigure (* args )
293
302
rec = self .getreportrecorder (config )
294
- items = Collection (config ).perform_collect ()
295
- return items , rec
303
+ collection = Collection (config )
304
+ collection .perform_collect ()
305
+ return collection .items , rec
296
306
297
307
def runitem (self , source ):
298
308
# used from runner functional tests
@@ -469,11 +479,12 @@ def runpytest(self, *args):
469
479
p = py .path .local .make_numbered_dir (prefix = "runpytest-" ,
470
480
keep = None , rootdir = self .tmpdir )
471
481
args = ('--basetemp=%s' % p , ) + args
472
- for x in args :
473
- if '--confcutdir' in str (x ):
474
- break
475
- else :
476
- args = ('--confcutdir=.' ,) + args
482
+ #for x in args:
483
+ # if '--confcutdir' in str(x):
484
+ # break
485
+ #else:
486
+ # pass
487
+ # args = ('--confcutdir=.',) + args
477
488
plugins = [x for x in self .plugins if isinstance (x , str )]
478
489
if plugins :
479
490
args = ('-p' , plugins [0 ]) + args
@@ -530,7 +541,7 @@ def matchreport(self, inamepart="", names="pytest_runtest_logreport pytest_colle
530
541
""" return a testreport whose dotted import path matches """
531
542
l = []
532
543
for rep in self .getreports (names = names ):
533
- if not inamepart or inamepart in rep .nodenames :
544
+ if not inamepart or inamepart in rep .nodeid . split ( "::" ) :
534
545
l .append (rep )
535
546
if not l :
536
547
raise ValueError ("could not find test report matching %r: no test reports at all!" %
@@ -616,6 +627,8 @@ def fnmatch_lines_random(self, lines2):
616
627
raise ValueError ("line %r not found in output" % line )
617
628
618
629
def fnmatch_lines (self , lines2 ):
630
+ def show (arg1 , arg2 ):
631
+ py .builtin .print_ (arg1 , arg2 , file = py .std .sys .stderr )
619
632
lines2 = self ._getlines (lines2 )
620
633
lines1 = self .lines [:]
621
634
nextline = None
@@ -626,17 +639,17 @@ def fnmatch_lines(self, lines2):
626
639
while lines1 :
627
640
nextline = lines1 .pop (0 )
628
641
if line == nextline :
629
- print_ ("exact match:" , repr (line ))
642
+ show ("exact match:" , repr (line ))
630
643
break
631
644
elif fnmatch (nextline , line ):
632
- print_ ("fnmatch:" , repr (line ))
633
- print_ (" with:" , repr (nextline ))
645
+ show ("fnmatch:" , repr (line ))
646
+ show (" with:" , repr (nextline ))
634
647
break
635
648
else :
636
649
if not nomatchprinted :
637
- print_ ("nomatch:" , repr (line ))
650
+ show ("nomatch:" , repr (line ))
638
651
nomatchprinted = True
639
- print_ (" and:" , repr (nextline ))
652
+ show (" and:" , repr (nextline ))
640
653
extralines .append (nextline )
641
654
else :
642
- assert line == nextline
655
+ py . test . fail ( "remains unmatched: %r, see stderr" % ( line ,))
0 commit comments