예제 #1
0
 def test_custom_event_loop(self):
     loop = CustomEventLoop()
     self.assertFalse(isinstance(loop.create_task, wrapt.ObjectProxy))
     asyncio.set_event_loop(loop)
     patch()
     self.assertTrue(isinstance(loop.create_task, wrapt.ObjectProxy))
     unpatch()
     self.assertFalse(isinstance(loop.create_task, wrapt.ObjectProxy))
예제 #2
0
 def test_after_set_event_loop(self):
     loop = asyncio.new_event_loop()
     self.assertNotIsInstance(loop.create_task, wrapt.ObjectProxy)
     asyncio.set_event_loop(loop)
     patch()
     self.assertIsInstance(loop.create_task, wrapt.ObjectProxy)
     unpatch()
     self.assertNotIsInstance(loop.create_task, wrapt.ObjectProxy)
예제 #3
0
 def test_event_loop_double_patch(self):
     # ensures that double patching will not double instrument
     # the event loop
     patch()
     self.test_tasks_chaining()
예제 #4
0
 def setUp(self):
     # patch asyncio event loop
     super(TestAsyncioPropagation, self).setUp()
     patch()
예제 #5
0
 def test_new_loop(self):
     patch()
     loop = asyncio.new_event_loop()
     self.assertIsInstance(loop.create_task, wrapt.ObjectProxy)
예제 #6
0
 def test_event_loop_double_patch(self):
     # ensures that double patching will not double instrument
     # the event loop
     patch()
     self.test_tasks_chaining()
예제 #7
0
 def setUp(self):
     # patch asyncio event loop
     super(TestAsyncioPropagation, self).setUp()
     patch()
예제 #8
0
async def test_event_loop_double_patch(tracer):
    # ensures that double patching will not double instrument
    # the event loop
    patch()
    patch()
    await test_tasks_chaining(tracer)
예제 #9
0
def test_event_loop_unpatch(tracer):
    patch()
    # ensures that the event loop can be unpatched
    unpatch()
    assert isinstance(tracer.context_provider, DefaultContextProvider)
    assert asyncio.BaseEventLoop.create_task == _orig_create_task