def test_import_error_in_warning_logging():
 class FakeModule(object, ):
  def __getattr__(self, attr):
   raise ImportError(u'_showwarning should ignore any exceptions here')
 log.enable_warnings_logging()
 sys.modules[u'<test fake module>'] = FakeModule()
 try:
  warnings.showwarning(AstropyWarning(u'Regression test for #2671'), AstropyWarning, u'<this is only a test>', 1)
 finally:
  del sys.modules[u'<test fake module>']

def test_import_error_in_warning_logging ( ) : class FakeModule ( object , ) : def __getattr__ ( self , attr ) : raise ImportError ( u'_showwarning should ignore any exceptions here' ) log . enable_warnings_logging ( ) sys . modules [ u'<test fake module>' ] = FakeModule ( ) try : warnings . showwarning ( AstropyWarning ( u'Regression test for #2671' ) , AstropyWarning , u'<this is only a test>' , 1 ) finally : del sys . modules [ u'<test fake module>' ]
regression test for URL this test actually puts a goofy fake module into sys .