1818from uuid import uuid4
1919
2020import click
21- import trino .logging
2221import pytest
23- from trino .client import TrinoQuery , TrinoRequest , ClientSession
24- from trino .constants import DEFAULT_PORT
2522
23+ import trino .logging
24+ from trino .client import ClientSession , TrinoQuery , TrinoRequest
25+ from trino .constants import DEFAULT_PORT
2626
2727logger = trino .logging .get_logger (__name__ )
2828
@@ -64,13 +64,7 @@ def start_trino(image_tag=None):
6464
6565
6666def 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" ))
7468 sql = "SELECT state FROM system.runtime.nodes"
7569 t0 = time .time ()
7670 while True :
@@ -116,9 +110,7 @@ def start_trino_and_wait(image_tag=None):
116110 if host :
117111 port = os .environ .get ("TRINO_RUNNING_PORT" , DEFAULT_PORT )
118112 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 )
122114
123115 print ("trino.server.hostname {}" .format (host ))
124116 print ("trino.server.port {}" .format (port ))
@@ -135,9 +127,7 @@ def stop_trino(container_id, proc):
135127
136128def find_images (name ):
137129 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 ])
141131 return [line .decode () for line in output .splitlines ()]
142132
143133
@@ -167,9 +157,7 @@ def cli():
167157 pass
168158
169159
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" )
173161@click .command ()
174162def trino_server ():
175163 container_id , _ , _ , _ = start_trino_and_wait ()
@@ -198,19 +186,14 @@ def trino_cli(container_id=None):
198186
199187@cli .command ("list" )
200188def 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-" ])
204190
205191
206192@cli .command ()
207193def clean ():
208194 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
214197 subprocess .check_output (cmd , shell = True )
215198
216199
0 commit comments