Skip to content

Commit 839d3af

Browse files
author
A. Jesse Jiryu Davis
committed
Daemonize threads used in tests so failed test won't hang process
1 parent 2a85681 commit 839d3af

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/test_threads.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def __init__(self, collection, num):
4848
self.coll = collection
4949
self.num = num
5050
self.success = True
51+
self.setDaemon(True)
5152

5253
def run(self):
5354
try:
@@ -64,6 +65,7 @@ class SaveAndFind(threading.Thread):
6465
def __init__(self, collection):
6566
threading.Thread.__init__(self)
6667
self.collection = collection
68+
self.setDaemon(True)
6769

6870
def run(self):
6971
sum = 0
@@ -79,6 +81,7 @@ def __init__(self, collection, n, expect_exception):
7981
self.collection = collection
8082
self.n = n
8183
self.expect_exception = expect_exception
84+
self.setDaemon(True)
8285

8386
def run(self):
8487
for _ in xrange(self.n):
@@ -102,6 +105,7 @@ def __init__(self, collection, n, expect_exception):
102105
self.collection = collection
103106
self.n = n
104107
self.expect_exception = expect_exception
108+
self.setDaemon(True)
105109

106110
def run(self):
107111
for _ in xrange(self.n):
@@ -125,6 +129,7 @@ def __init__(self, collection, n):
125129
threading.Thread.__init__(self)
126130
self.c = collection
127131
self.n = n
132+
self.setDaemon(True)
128133

129134
def run(self):
130135
for _ in range(self.n):

0 commit comments

Comments
 (0)