Skip to content

Commit 18100c9

Browse files
committed
test: address PR feedback for worker thread errors and signals
- Simplify worker thread assertion message to safely print errors list - Add verification for signal handler registration details Signed-off-by: MBM <mihir105@gmail.com>
1 parent 6e7caaf commit 18100c9

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

sdk/python/feast/infra/offline_stores/contrib/trino_offline_store/tests/test_trino_queries.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import signal
12
import threading
23
from unittest.mock import MagicMock, patch
34

@@ -11,11 +12,16 @@ def test_query_init_in_main_thread_registers_signals():
1112

1213
# Should not raise any exception in main thread
1314
cursor = MagicMock()
15+
1416
with patch("signal.signal") as mock_signal:
17+
query = Query(query_text="SELECT 1", cursor=cursor)
18+
assert query.query_text == "SELECT 1"
19+
1520
# Verify signal handlers are registered correctly
16-
assert mock_signal.call_count == 2
1721
mock_signal.assert_any_call(signal.SIGINT, query.cancel)
1822
mock_signal.assert_any_call(signal.SIGTERM, query.cancel)
23+
24+
# Expected signal.signal to be called twice for SIGINT and SIGTERM
1925
assert mock_signal.call_count == 2
2026

2127

@@ -39,4 +45,4 @@ def create_query():
3945
thread.start()
4046
thread.join()
4147

42-
assert not errors, f"Unexpected ValueError in worker thread: {errors[0]}"
48+
assert not errors, f"Unexpected ValueError in worker thread: {errors}"

0 commit comments

Comments
 (0)