fix TestThread

Signed-off-by: ThreadDao <yufen.zong@zilliz.com>
pull/4973/head^2
ThreadDao 2021-03-04 16:15:05 +08:00 committed by yefu.chen
parent dec0b40a66
commit 22063c6d8a
9 changed files with 13 additions and 13 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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")

View File

@ -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)

View File

@ -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