From 22063c6d8a8ca652ae1ace0a466c17a7c105109a Mon Sep 17 00:00:00 2001 From: ThreadDao Date: Thu, 4 Mar 2021 16:15:05 +0800 Subject: [PATCH] fix TestThread Signed-off-by: ThreadDao --- tests/python_test/collection/test_create_collection.py | 2 +- tests/python_test/collection/test_describe_collection.py | 2 +- tests/python_test/collection/test_drop_collection.py | 2 +- tests/python_test/collection/test_has_collection.py | 2 +- tests/python_test/collection/test_list_collections.py | 2 +- tests/python_test/entity/test_search.py | 4 ++-- tests/python_test/test_flush.py | 2 +- tests/python_test/test_index.py | 4 ++-- tests/python_test/utils.py | 6 +++--- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/python_test/collection/test_create_collection.py b/tests/python_test/collection/test_create_collection.py index 2a3f1a9fe..cf6150ff8 100644 --- a/tests/python_test/collection/test_create_collection.py +++ b/tests/python_test/collection/test_create_collection.py @@ -165,7 +165,7 @@ class TestCreateCollection: connect.create_collection(collection_name, default_fields) for i in range(threads_num): - t = TestThread(target=create, args=()) + t = MyThread(target=create, args=()) threads.append(t) t.start() time.sleep(0.2) diff --git a/tests/python_test/collection/test_describe_collection.py b/tests/python_test/collection/test_describe_collection.py index f441cdb43..7ff0087c2 100644 --- a/tests/python_test/collection/test_describe_collection.py +++ b/tests/python_test/collection/test_describe_collection.py @@ -121,7 +121,7 @@ class TestDescribeCollection: connect.describe_collection(collection_name) for i in range(threads_num): - t = TestThread(target=get_info) + t = MyThread(target=get_info) threads.append(t) t.start() time.sleep(0.2) diff --git a/tests/python_test/collection/test_drop_collection.py b/tests/python_test/collection/test_drop_collection.py index f3fe56c3b..e14be1992 100644 --- a/tests/python_test/collection/test_drop_collection.py +++ b/tests/python_test/collection/test_drop_collection.py @@ -74,7 +74,7 @@ class TestDropCollection: connect.create_collection(collection_name, default_fields) connect.drop_collection(collection_name) for i in range(threads_num): - t = TestThread(target=create, args=()) + t = MyThread(target=create, args=()) threads.append(t) t.start() time.sleep(0.2) diff --git a/tests/python_test/collection/test_has_collection.py b/tests/python_test/collection/test_has_collection.py index 688cbd9f3..c2db0084c 100644 --- a/tests/python_test/collection/test_has_collection.py +++ b/tests/python_test/collection/test_has_collection.py @@ -68,7 +68,7 @@ class TestHasCollection: assert connect.has_collection(collection_name) # assert not assert_collection(connect, collection_name) for i in range(threads_num): - t = TestThread(target=has, args=()) + t = MyThread(target=has, args=()) threads.append(t) t.start() time.sleep(0.2) diff --git a/tests/python_test/collection/test_list_collections.py b/tests/python_test/collection/test_list_collections.py index a150efbdc..42d4cf5b2 100644 --- a/tests/python_test/collection/test_list_collections.py +++ b/tests/python_test/collection/test_list_collections.py @@ -91,7 +91,7 @@ class TestListCollections: assert collection_name in connect.list_collections() for i in range(threads_num): - t = TestThread(target=_list) + t = MyThread(target=_list) threads.append(t) t.start() time.sleep(0.2) diff --git a/tests/python_test/entity/test_search.py b/tests/python_test/entity/test_search.py index 263da5b6f..34d03b670 100644 --- a/tests/python_test/entity/test_search.py +++ b/tests/python_test/entity/test_search.py @@ -883,7 +883,7 @@ class TestSearchBase: for i in range(threads_num): milvus = get_milvus(args["ip"], args["port"], handler=args["handler"]) - t = TestThread(target=search, args=(milvus,)) + t = MyThread(target=search, args=(milvus,)) threads.append(t) t.start() time.sleep(0.2) @@ -918,7 +918,7 @@ class TestSearchBase: assert res[0]._distances[0] < epsilon for i in range(threads_num): - t = TestThread(target=search, args=(milvus,)) + t = MyThread(target=search, args=(milvus,)) threads.append(t) t.start() time.sleep(0.2) diff --git a/tests/python_test/test_flush.py b/tests/python_test/test_flush.py index 40a914abe..ccd028345 100644 --- a/tests/python_test/test_flush.py +++ b/tests/python_test/test_flush.py @@ -269,7 +269,7 @@ class TestFlushBase: milvus.flush([collection]) logging.error("end flush") - p = TestThread(target=flush, args=()) + p = MyThread(target=flush, args=()) p.start() time.sleep(0.2) logging.error("start count") diff --git a/tests/python_test/test_index.py b/tests/python_test/test_index.py index e121dd4b5..021ab65e6 100644 --- a/tests/python_test/test_index.py +++ b/tests/python_test/test_index.py @@ -170,7 +170,7 @@ class TestIndexBase: threads = [] for i in range(threads_num): m = get_milvus(host=args["ip"], port=args["port"], handler=args["handler"]) - t = TestThread(target=build, args=(m,)) + t = MyThread(target=build, args=(m,)) threads.append(t) t.start() time.sleep(0.2) @@ -330,7 +330,7 @@ class TestIndexBase: threads = [] for i in range(threads_num): m = get_milvus(host=args["ip"], port=args["port"], handler=args["handler"]) - t = TestThread(target=build, args=(m,)) + t = MyThread(target=build, args=(m,)) threads.append(t) t.start() time.sleep(0.2) diff --git a/tests/python_test/utils.py b/tests/python_test/utils.py index 95d414ac8..0d8e1e2c7 100644 --- a/tests/python_test/utils.py +++ b/tests/python_test/utils.py @@ -989,19 +989,19 @@ def compare_list_elements(_first, _second): return True -class TestThread(threading.Thread): +class MyThread(threading.Thread): def __init__(self, target, args=()): threading.Thread.__init__(self, target=target, args=args) def run(self): self.exc = None try: - super(TestThread, self).run() + super(MyThread, self).run() except BaseException as e: self.exc = e logging.error(traceback.format_exc()) def join(self): - super(TestThread, self).join() + super(MyThread, self).join() if self.exc: raise self.exc -- GitLab