Skip to content

Commit

Permalink
+ added test for kill method
Browse files Browse the repository at this point in the history
  • Loading branch information
caffeine-addictt committed Nov 16, 2023
1 parent 41c8678 commit 711a0f3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ def _dummy_raiseException(x: Exception, delay: float = 0):
time.sleep(delay)
raise x

def _dummy_iterative(itemCount: int, pTime: float = 0.1, delay: float = 0):
time.sleep(delay)
for i in range(itemCount):
time.sleep(pTime)




Expand Down Expand Up @@ -76,6 +81,16 @@ def test_ignoreAll():
new.join()
assert len(new.errors) == 0

def test_threadKilling():
"""This test is for testing that threads are killed properly"""
new = Thread(
target = _dummy_iterative,
args = [5, 0.1, 0]
)
new.start()
new.kill(True)
assert not new.is_alive()




Expand Down

0 comments on commit 711a0f3

Please sign in to comment.