From 780a1ab7f44fc8d628b7874de7026434509eb7f2 Mon Sep 17 00:00:00 2001 From: Karthikeyan Singaravelan Date: Thu, 9 Dec 2021 07:06:24 +0000 Subject: [PATCH] Use assertEqual instead of assertEquals for Python 3.11 compatibility. --- .../test_asyncio.py | 20 +++++++++---------- .../test_gevent.py | 20 +++++++++---------- .../test_threads.py | 20 +++++++++---------- .../test_tornado.py | 20 +++++++++---------- .../test_listener_per_request/test_asyncio.py | 2 +- .../test_listener_per_request/test_gevent.py | 2 +- .../test_listener_per_request/test_threads.py | 2 +- .../test_listener_per_request/test_tornado.py | 2 +- .../test_multiple_callbacks/test_asyncio.py | 2 +- .../test_multiple_callbacks/test_gevent.py | 2 +- .../test_multiple_callbacks/test_threads.py | 2 +- .../test_multiple_callbacks/test_tornado.py | 2 +- 12 files changed, 48 insertions(+), 48 deletions(-) diff --git a/testbed/test_common_request_handler/test_asyncio.py b/testbed/test_common_request_handler/test_asyncio.py index 0042a55..7d21503 100644 --- a/testbed/test_common_request_handler/test_asyncio.py +++ b/testbed/test_common_request_handler/test_asyncio.py @@ -61,15 +61,15 @@ def test_two_callbacks(self): lambda: len(self.tracer.finished_spans()) >= 2) self.loop.run_forever() - self.assertEquals('message1::response', res_future1.result()) - self.assertEquals('message2::response', res_future2.result()) + self.assertEqual('message1::response', res_future1.result()) + self.assertEqual('message2::response', res_future2.result()) spans = self.tracer.finished_spans() - self.assertEquals(len(spans), 2) + self.assertEqual(len(spans), 2) for span in spans: - self.assertEquals(span.tags.get(tags.SPAN_KIND, None), - tags.SPAN_KIND_RPC_CLIENT) + self.assertEqual(span.tags.get(tags.SPAN_KIND, None), + tags.SPAN_KIND_RPC_CLIENT) self.assertNotSameTrace(spans[0], spans[1]) self.assertIsNone(spans[0].parent_id) @@ -81,12 +81,12 @@ def test_parent_not_picked(self): async def do(): with self.tracer.start_active_span('parent'): response = await self.client.send_task('no_parent') - self.assertEquals('no_parent::response', response) + self.assertEqual('no_parent::response', response) self.loop.run_until_complete(do()) spans = self.tracer.finished_spans() - self.assertEquals(len(spans), 2) + self.assertEqual(len(spans), 2) child_span = get_one_by_operation_name(spans, 'send') self.assertIsNotNone(child_span) @@ -107,17 +107,17 @@ async def do(): client = Client(req_handler, self.loop) response = await client.send_task('correct_parent') - self.assertEquals('correct_parent::response', response) + self.assertEqual('correct_parent::response', response) # Send second request, now there is no active parent, # but it will be set, ups response = await client.send_task('wrong_parent') - self.assertEquals('wrong_parent::response', response) + self.assertEqual('wrong_parent::response', response) self.loop.run_until_complete(do()) spans = self.tracer.finished_spans() - self.assertEquals(len(spans), 3) + self.assertEqual(len(spans), 3) spans = sorted(spans, key=lambda x: x.start_time) parent_span = get_one_by_operation_name(spans, 'parent') diff --git a/testbed/test_common_request_handler/test_gevent.py b/testbed/test_common_request_handler/test_gevent.py index 975d2ca..7c300b4 100644 --- a/testbed/test_common_request_handler/test_gevent.py +++ b/testbed/test_common_request_handler/test_gevent.py @@ -57,15 +57,15 @@ def test_two_callbacks(self): gevent.joinall([response_greenlet1, response_greenlet2]) - self.assertEquals('message1::response', response_greenlet1.get()) - self.assertEquals('message2::response', response_greenlet2.get()) + self.assertEqual('message1::response', response_greenlet1.get()) + self.assertEqual('message2::response', response_greenlet2.get()) spans = self.tracer.finished_spans() - self.assertEquals(len(spans), 2) + self.assertEqual(len(spans), 2) for span in spans: - self.assertEquals(span.tags.get(tags.SPAN_KIND, None), - tags.SPAN_KIND_RPC_CLIENT) + self.assertEqual(span.tags.get(tags.SPAN_KIND, None), + tags.SPAN_KIND_RPC_CLIENT) self.assertNotSameTrace(spans[0], spans[1]) self.assertIsNone(spans[0].parent_id) @@ -76,10 +76,10 @@ def test_parent_not_picked(self): with self.tracer.start_active_span('parent'): response = self.client.send_sync('no_parent') - self.assertEquals('no_parent::response', response) + self.assertEqual('no_parent::response', response) spans = self.tracer.finished_spans() - self.assertEquals(len(spans), 2) + self.assertEqual(len(spans), 2) child_span = get_one_by_operation_name(spans, 'send') self.assertIsNotNone(child_span) @@ -98,13 +98,13 @@ def test_bad_solution_to_set_parent(self): client = Client(RequestHandler(self.tracer, scope.span.context)) response = client.send_sync('correct_parent') - self.assertEquals('correct_parent::response', response) + self.assertEqual('correct_parent::response', response) response = client.send_sync('wrong_parent') - self.assertEquals('wrong_parent::response', response) + self.assertEqual('wrong_parent::response', response) spans = self.tracer.finished_spans() - self.assertEquals(len(spans), 3) + self.assertEqual(len(spans), 3) spans = sorted(spans, key=lambda x: x.start_time) parent_span = get_one_by_operation_name(spans, 'parent') diff --git a/testbed/test_common_request_handler/test_threads.py b/testbed/test_common_request_handler/test_threads.py index 4135698..c2462b0 100644 --- a/testbed/test_common_request_handler/test_threads.py +++ b/testbed/test_common_request_handler/test_threads.py @@ -56,15 +56,15 @@ def test_two_callbacks(self): response_future1 = self.client.send('message1') response_future2 = self.client.send('message2') - self.assertEquals('message1::response', response_future1.result(5.0)) - self.assertEquals('message2::response', response_future2.result(5.0)) + self.assertEqual('message1::response', response_future1.result(5.0)) + self.assertEqual('message2::response', response_future2.result(5.0)) spans = self.tracer.finished_spans() - self.assertEquals(len(spans), 2) + self.assertEqual(len(spans), 2) for span in spans: - self.assertEquals(span.tags.get(tags.SPAN_KIND, None), - tags.SPAN_KIND_RPC_CLIENT) + self.assertEqual(span.tags.get(tags.SPAN_KIND, None), + tags.SPAN_KIND_RPC_CLIENT) self.assertNotSameTrace(spans[0], spans[1]) self.assertIsNone(spans[0].parent_id) @@ -75,10 +75,10 @@ def test_parent_not_picked(self): with self.tracer.start_active_span('parent'): response = self.client.send_sync('no_parent') - self.assertEquals('no_parent::response', response) + self.assertEqual('no_parent::response', response) spans = self.tracer.finished_spans() - self.assertEquals(len(spans), 2) + self.assertEqual(len(spans), 2) child_span = get_one_by_operation_name(spans, 'send') self.assertIsNotNone(child_span) @@ -97,13 +97,13 @@ def test_bad_solution_to_set_parent(self): client = Client(RequestHandler(self.tracer, scope.span.context), self.executor) response = client.send_sync('correct_parent') - self.assertEquals('correct_parent::response', response) + self.assertEqual('correct_parent::response', response) response = client.send_sync('wrong_parent') - self.assertEquals('wrong_parent::response', response) + self.assertEqual('wrong_parent::response', response) spans = self.tracer.finished_spans() - self.assertEquals(len(spans), 3) + self.assertEqual(len(spans), 3) spans = sorted(spans, key=lambda x: x.start_time) parent_span = get_one_by_operation_name(spans, 'parent') diff --git a/testbed/test_common_request_handler/test_tornado.py b/testbed/test_common_request_handler/test_tornado.py index 3f0bfd6..507d641 100644 --- a/testbed/test_common_request_handler/test_tornado.py +++ b/testbed/test_common_request_handler/test_tornado.py @@ -66,15 +66,15 @@ def test_two_callbacks(self): lambda: len(self.tracer.finished_spans()) >= 2) self.loop.start() - self.assertEquals('message1::response', res_future1.result()) - self.assertEquals('message2::response', res_future2.result()) + self.assertEqual('message1::response', res_future1.result()) + self.assertEqual('message2::response', res_future2.result()) spans = self.tracer.finished_spans() - self.assertEquals(len(spans), 2) + self.assertEqual(len(spans), 2) for span in spans: - self.assertEquals(span.tags.get(tags.SPAN_KIND, None), - tags.SPAN_KIND_RPC_CLIENT) + self.assertEqual(span.tags.get(tags.SPAN_KIND, None), + tags.SPAN_KIND_RPC_CLIENT) self.assertNotSameTrace(spans[0], spans[1]) self.assertIsNone(spans[0].parent_id) @@ -87,10 +87,10 @@ def test_parent_not_picked(self): with tracer_stack_context(): with self.tracer.start_active_span('parent'): response = self.client.send_sync('no_parent') - self.assertEquals('no_parent::response', response) + self.assertEqual('no_parent::response', response) spans = self.tracer.finished_spans() - self.assertEquals(len(spans), 2) + self.assertEqual(len(spans), 2) child_span = get_one_by_operation_name(spans, 'send') self.assertIsNotNone(child_span) @@ -112,14 +112,14 @@ def test_good_solution_to_set_parent(self): client = Client(req_handler, self.loop) response = client.send_sync('correct_parent') - self.assertEquals('correct_parent::response', response) + self.assertEqual('correct_parent::response', response) # Should NOT be a child of the previously activated Span response = client.send_sync('wrong_parent') - self.assertEquals('wrong_parent::response', response) + self.assertEqual('wrong_parent::response', response) spans = self.tracer.finished_spans() - self.assertEquals(len(spans), 3) + self.assertEqual(len(spans), 3) spans = sorted(spans, key=lambda x: x.start_time) parent_span = get_one_by_operation_name(spans, 'parent') diff --git a/testbed/test_listener_per_request/test_asyncio.py b/testbed/test_listener_per_request/test_asyncio.py index b5731f9..c627a55 100644 --- a/testbed/test_listener_per_request/test_asyncio.py +++ b/testbed/test_listener_per_request/test_asyncio.py @@ -37,7 +37,7 @@ def setUp(self): def test_main(self): client = Client(self.tracer, self.loop) res = client.send_sync('message') - self.assertEquals(res, 'message::response') + self.assertEqual(res, 'message::response') spans = self.tracer.finished_spans() self.assertEqual(len(spans), 1) diff --git a/testbed/test_listener_per_request/test_gevent.py b/testbed/test_listener_per_request/test_gevent.py index 5300e38..fb32257 100644 --- a/testbed/test_listener_per_request/test_gevent.py +++ b/testbed/test_listener_per_request/test_gevent.py @@ -35,7 +35,7 @@ def setUp(self): def test_main(self): client = Client(self.tracer) res = client.send_sync('message') - self.assertEquals(res, 'message::response') + self.assertEqual(res, 'message::response') spans = self.tracer.finished_spans() self.assertEqual(len(spans), 1) diff --git a/testbed/test_listener_per_request/test_threads.py b/testbed/test_listener_per_request/test_threads.py index d69b998..7dbb896 100644 --- a/testbed/test_listener_per_request/test_threads.py +++ b/testbed/test_listener_per_request/test_threads.py @@ -35,7 +35,7 @@ def setUp(self): def test_main(self): client = Client(self.tracer) res = client.send_sync('message') - self.assertEquals(res, 'message::response') + self.assertEqual(res, 'message::response') spans = self.tracer.finished_spans() self.assertEqual(len(spans), 1) diff --git a/testbed/test_listener_per_request/test_tornado.py b/testbed/test_listener_per_request/test_tornado.py index 1a282bb..e58db06 100644 --- a/testbed/test_listener_per_request/test_tornado.py +++ b/testbed/test_listener_per_request/test_tornado.py @@ -41,7 +41,7 @@ def setUp(self): def test_main(self): client = Client(self.tracer, self.loop) res = client.send_sync('message') - self.assertEquals(res, 'message::response') + self.assertEqual(res, 'message::response') spans = self.tracer.finished_spans() self.assertEqual(len(spans), 1) diff --git a/testbed/test_multiple_callbacks/test_asyncio.py b/testbed/test_multiple_callbacks/test_asyncio.py index 2e29dd2..89945d2 100644 --- a/testbed/test_multiple_callbacks/test_asyncio.py +++ b/testbed/test_multiple_callbacks/test_asyncio.py @@ -34,7 +34,7 @@ async def main_task(): self.loop.run_forever() spans = self.tracer.finished_spans() - self.assertEquals(len(spans), 4) + self.assertEqual(len(spans), 4) self.assertNamesEqual(spans, ['task', 'task', 'task', 'parent']) for i in range(3): diff --git a/testbed/test_multiple_callbacks/test_gevent.py b/testbed/test_multiple_callbacks/test_gevent.py index f680507..7194d75 100644 --- a/testbed/test_multiple_callbacks/test_gevent.py +++ b/testbed/test_multiple_callbacks/test_gevent.py @@ -28,7 +28,7 @@ def main_task(): gevent.wait(timeout=5.0) spans = self.tracer.finished_spans() - self.assertEquals(len(spans), 4) + self.assertEqual(len(spans), 4) self.assertNamesEqual(spans, ['task', 'task', 'task', 'parent']) for i in range(3): diff --git a/testbed/test_multiple_callbacks/test_threads.py b/testbed/test_multiple_callbacks/test_threads.py index af8e14c..3622cb1 100644 --- a/testbed/test_multiple_callbacks/test_threads.py +++ b/testbed/test_multiple_callbacks/test_threads.py @@ -33,7 +33,7 @@ def test_main(self): self.executor.shutdown(True) spans = self.tracer.finished_spans() - self.assertEquals(len(spans), 4) + self.assertEqual(len(spans), 4) self.assertNamesEqual(spans, ['task', 'task', 'task', 'parent']) for i in range(3): diff --git a/testbed/test_multiple_callbacks/test_tornado.py b/testbed/test_multiple_callbacks/test_tornado.py index b4b7b7b..8571925 100644 --- a/testbed/test_multiple_callbacks/test_tornado.py +++ b/testbed/test_multiple_callbacks/test_tornado.py @@ -35,7 +35,7 @@ def main_task(): self.loop.start() spans = self.tracer.finished_spans() - self.assertEquals(len(spans), 4) + self.assertEqual(len(spans), 4) self.assertNamesEqual(spans, ['task', 'task', 'task', 'parent']) for i in range(3):