18
18
from uuid import uuid4
19
19
20
20
import click
21
- import trino .logging
22
21
import pytest
23
- from trino .client import TrinoQuery , TrinoRequest , ClientSession
24
- from trino .constants import DEFAULT_PORT
25
22
23
+ import trino .logging
24
+ from trino .client import ClientSession , TrinoQuery , TrinoRequest
25
+ from trino .constants import DEFAULT_PORT
26
26
27
27
logger = trino .logging .get_logger (__name__ )
28
28
@@ -64,13 +64,7 @@ def start_trino(image_tag=None):
64
64
65
65
66
66
def wait_for_trino_workers (host , port , timeout = 180 ):
67
- request = TrinoRequest (
68
- host = host ,
69
- port = port ,
70
- client_session = ClientSession (
71
- user = "test_fixture"
72
- )
73
- )
67
+ request = TrinoRequest (host = host , port = port , client_session = ClientSession (user = "test_fixture" ))
74
68
sql = "SELECT state FROM system.runtime.nodes"
75
69
t0 = time .time ()
76
70
while True :
@@ -116,9 +110,7 @@ def start_trino_and_wait(image_tag=None):
116
110
if host :
117
111
port = os .environ .get ("TRINO_RUNNING_PORT" , DEFAULT_PORT )
118
112
else :
119
- container_id , proc , host , port = start_local_trino_server (
120
- image_tag
121
- )
113
+ container_id , proc , host , port = start_local_trino_server (image_tag )
122
114
123
115
print ("trino.server.hostname {}" .format (host ))
124
116
print ("trino.server.port {}" .format (port ))
@@ -135,9 +127,7 @@ def stop_trino(container_id, proc):
135
127
136
128
def find_images (name ):
137
129
assert name
138
- output = subprocess .check_output (
139
- ["docker" , "images" , "--format" , "{{.Repository}}:{{.Tag}}" , name ]
140
- )
130
+ output = subprocess .check_output (["docker" , "images" , "--format" , "{{.Repository}}:{{.Tag}}" , name ])
141
131
return [line .decode () for line in output .splitlines ()]
142
132
143
133
@@ -167,9 +157,7 @@ def cli():
167
157
pass
168
158
169
159
170
- @click .option (
171
- "--cache/--no-cache" , default = True , help = "enable/disable Docker build cache"
172
- )
160
+ @click .option ("--cache/--no-cache" , default = True , help = "enable/disable Docker build cache" )
173
161
@click .command ()
174
162
def trino_server ():
175
163
container_id , _ , _ , _ = start_trino_and_wait ()
@@ -198,19 +186,14 @@ def trino_cli(container_id=None):
198
186
199
187
@cli .command ("list" )
200
188
def list_ ():
201
- subprocess .check_call (
202
- ["docker" , "ps" , "--filter" , "name=trino-python-client-tests-" ]
203
- )
189
+ subprocess .check_call (["docker" , "ps" , "--filter" , "name=trino-python-client-tests-" ])
204
190
205
191
206
192
@cli .command ()
207
193
def clean ():
208
194
cmd = (
209
- "docker ps "
210
- "--filter name=trino-python-client-tests- "
211
- "--format={{.Names}} | "
212
- "xargs -n 1 docker kill" # NOQA deliberate additional indent
213
- )
195
+ "docker ps " "--filter name=trino-python-client-tests- " "--format={{.Names}} | " "xargs -n 1 docker kill"
196
+ ) # NOQA deliberate additional indent
214
197
subprocess .check_output (cmd , shell = True )
215
198
216
199
0 commit comments