Skip to content

Commit 6f2109d

Browse files
committed
fixed lint issues
1 parent 2b45ed9 commit 6f2109d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/unit/test_client.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,9 +1453,11 @@ def delete_password(self, servicename, username):
14531453
def test_trinoquery_heartbeat_success(mock_requests, sample_post_response_data, sample_get_response_data):
14541454
"""Test that heartbeat is sent periodically and does not stop on success."""
14551455
head_call_count = 0
1456+
14561457
def fake_head(url, timeout=10):
14571458
nonlocal head_call_count
14581459
head_call_count += 1
1460+
14591461
class Resp:
14601462
status_code = 200
14611463
return Resp()
@@ -1470,6 +1472,7 @@ class Resp:
14701472
http_scheme="http",
14711473
)
14721474
query = TrinoQuery(request=req, query="SELECT 1", heartbeat_interval=0.1)
1475+
14731476
def finish_query(*args, **kwargs):
14741477
query._finished = True
14751478
return []
@@ -1481,6 +1484,7 @@ def finish_query(*args, **kwargs):
14811484
query._stop_heartbeat()
14821485
assert head_call_count >= 2
14831486

1487+
14841488
@mock.patch("trino.client.TrinoRequest.http")
14851489
def test_trinoquery_heartbeat_failure_stops(mock_requests, sample_post_response_data, sample_get_response_data):
14861490
"""Test that heartbeat stops after 3 consecutive failures."""
@@ -1506,6 +1510,7 @@ class Resp:
15061510
assert not query._heartbeat_enabled
15071511
query._stop_heartbeat()
15081512

1513+
15091514
@mock.patch("trino.client.TrinoRequest.http")
15101515
def test_trinoquery_heartbeat_404_405_stops(mock_requests, sample_post_response_data, sample_get_response_data):
15111516
"""Test that heartbeat stops if server returns 404 or 405."""
@@ -1532,13 +1537,16 @@ class Resp:
15321537
assert not query._heartbeat_enabled
15331538
query._stop_heartbeat()
15341539

1540+
15351541
@mock.patch("trino.client.TrinoRequest.http")
15361542
def test_trinoquery_heartbeat_stops_on_finish(mock_requests, sample_post_response_data, sample_get_response_data):
15371543
"""Test that heartbeat stops when the query is finished."""
15381544
head_call_count = 0
1545+
15391546
def fake_head(url, timeout=10):
15401547
nonlocal head_call_count
15411548
head_call_count += 1
1549+
15421550
class Resp:
15431551
status_code = 200
15441552
return Resp()
@@ -1563,13 +1571,16 @@ class Resp:
15631571
# Heartbeat should have stopped after query finished
15641572
assert head_call_count >= 1
15651573

1574+
15661575
@mock.patch("trino.client.TrinoRequest.http")
15671576
def test_trinoquery_heartbeat_stops_on_cancel(mock_requests, sample_post_response_data, sample_get_response_data):
15681577
"""Test that heartbeat stops when the query is cancelled."""
15691578
head_call_count = 0
1579+
15701580
def fake_head(url, timeout=10):
15711581
nonlocal head_call_count
15721582
head_call_count += 1
1583+
15731584
class Resp:
15741585
status_code = 200
15751586
return Resp()

0 commit comments

Comments
 (0)