예제 #1
0
 def test_emitter_exception(self):
     emitter = Emitter(urls=['file:///tmp/test_emitter'],
                       emitter_args={'extra': '{"a2}',
                                     'extra_all_features': True,
                                     'uuid': 'aaaaaa'},
                       format='csv')
     emitter.__enter__()
     emitter.__exit__(None, ValueError('a'), None)
 def test_emitter_exception(self):
     emitter = Emitter(urls=['file:///tmp/test_emitter'],
                       emitter_args={'extra': '{"a2}',
                                     'extra_all_features': True,
                                     'uuid': 'aaaaaa'},
                       format='csv')
     emitter.__enter__()
     emitter.__exit__(None, ValueError('a'), None)
    def test_emitter_exception(self):
        emitter = Emitter(urls=['file:///tmp/test_emitter'],
                          emitter_args={'extra': '{"a2}',
                                        'extra_all_features': True,
                                        'uuid': 'aaaaaa'},
                          format='csv')
        emitter.__enter__()
        with self.assertRaises(ValueError):
            emitter.__exit__(None, ValueError('a'), None)

        with self.assertRaises(ValueError):
            with Emitter(urls=['file:///tmp/test_emitter'],
                         emitter_args={'extra': '{"a2}',
                                       'extra_all_features': True,
                                       'uuid': 'aaaaaa'},
                         format='csv') as emitter:
                raise ValueError('bla')