Skip to content

Commit 9dc7e1c

Browse files
Merge pull request #53 from python-thread/tests/thread-killing
Test: Improving thread killing
2 parents ab8ae94 + eb65675 commit 9dc7e1c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/test_thread.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,22 @@ def test_ignoreAll():
8383

8484
def test_threadKilling():
8585
"""This test is for testing that threads are killed properly"""
86+
stdout = []
87+
88+
def _dummy_target_killThread(x: int, delay: float = 0):
89+
for i in range(x):
90+
stdout.append(i)
91+
time.sleep(delay)
92+
8693
new = Thread(
87-
target = _dummy_iterative,
88-
args = [5, 0.1, 0]
94+
target = _dummy_target_killThread,
95+
args = [4, 1],
96+
daemon = True
8997
)
9098
new.start()
9199
new.kill(True)
92100
assert not new.is_alive()
101+
assert len(stdout) != 4
93102

94103

95104

0 commit comments

Comments
 (0)