@contextmanager
def all_warnings():
 frame = inspect.currentframe()
 if frame:
  for f in inspect.getouterframes(frame):
   f[0].f_locals['__warningregistry__'] = {}
 del frame
 for (mod_name, mod) in list(sys.modules.items()):
  if ('six.moves' in mod_name):
   continue
  try:
   mod.__warningregistry__.clear()
  except AttributeError:
   pass
 with warnings.catch_warnings(record=True) as w:
  warnings.simplefilter('always')
  (yield w)

@ contextmanager def all_warnings ( ) : frame = inspect . currentframe ( ) if frame : for f in inspect . getouterframes ( frame ) : f [ 0 ] . f_locals [ '__warningregistry__' ] = { } del frame for ( mod_name , mod ) in list ( sys . modules . items ( ) ) : if ( 'six.moves' in mod_name ) : continue try : mod . __warningregistry__ . clear ( ) except AttributeError : pass with warnings . catch_warnings ( record = True ) as w : warnings . simplefilter ( 'always' ) ( yield w )
context for use in testing to ensure that all warnings are raised .