@pytest.yield_fixture
def recwarn(request):
 wrec = WarningsRecorder()
 with wrec:
  warnings.simplefilter('default')
  (yield wrec)

@ pytest . yield_fixture def recwarn ( request ) : wrec = WarningsRecorder ( ) with wrec : warnings . simplefilter ( 'default' ) ( yield wrec )
return a warningsrecorder instance that provides these methods: * pop: return last warning matching the category .