Skip to content

Commit 209640a

Browse files
committed
assert that the worker is still alive until stopped
1 parent 0eccc7a commit 209640a

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

tests/push/test_segment_worker.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ def handler_sync(change_number):
3535
with pytest.raises(Exception):
3636
segment_worker._handler()
3737

38+
assert segment_worker.is_running()
39+
assert segment_worker._worker.is_alive()
40+
segment_worker.stop()
41+
time.sleep(1)
42+
assert not segment_worker.is_running()
43+
assert not segment_worker._worker.is_alive()
44+
3845
def test_handler(self):
3946
q = queue.Queue()
4047
segment_worker = SegmentWorker(handler_sync, q)

tests/push/test_split_worker.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ def handler_sync(change_number):
3232
with pytest.raises(Exception):
3333
split_worker._handler()
3434

35+
assert split_worker.is_running()
36+
assert split_worker._worker.is_alive()
37+
split_worker.stop()
38+
time.sleep(1)
39+
assert not split_worker.is_running()
40+
assert not split_worker._worker.is_alive()
41+
3542
def test_handler(self):
3643
q = queue.Queue()
3744
split_worker = SplitWorker(handler_sync, q)

0 commit comments

Comments
 (0)