@@ -82,11 +82,15 @@ def func(x, y):
8282
8383 metafunc = self .Metafunc (func )
8484 metafunc .parametrize ("x" , [1 , 2 ])
85- pytest .raises (ValueError , lambda : metafunc .parametrize ("x" , [5 , 6 ]))
86- pytest .raises (ValueError , lambda : metafunc .parametrize ("x" , [5 , 6 ]))
85+ with pytest .raises (pytest .Collector .CollectError ):
86+ metafunc .parametrize ("x" , [5 , 6 ])
87+ with pytest .raises (pytest .Collector .CollectError ):
88+ metafunc .parametrize ("x" , [5 , 6 ])
8789 metafunc .parametrize ("y" , [1 , 2 ])
88- pytest .raises (ValueError , lambda : metafunc .parametrize ("y" , [5 , 6 ]))
89- pytest .raises (ValueError , lambda : metafunc .parametrize ("y" , [5 , 6 ]))
90+ with pytest .raises (pytest .Collector .CollectError ):
91+ metafunc .parametrize ("y" , [5 , 6 ])
92+ with pytest .raises (pytest .Collector .CollectError ):
93+ metafunc .parametrize ("y" , [5 , 6 ])
9094
9195 with pytest .raises (TypeError , match = "^ids must be a callable or an iterable$" ):
9296 metafunc .parametrize ("y" , [5 , 6 ], ids = 42 ) # type: ignore[arg-type]
0 commit comments