17
17
from contextlib import closing
18
18
from uuid import uuid4
19
19
20
- import click
21
20
import pytest
22
21
23
22
import trino .logging
@@ -133,19 +132,6 @@ def stop_trino(container_id, proc):
133
132
subprocess .check_call (["docker" , "kill" , container_id ])
134
133
135
134
136
- def find_images (name ):
137
- assert name
138
- output = subprocess .check_output (
139
- ["docker" , "images" , "--format" , "{{.Repository}}:{{.Tag}}" , name ]
140
- )
141
- return [line .decode () for line in output .splitlines ()]
142
-
143
-
144
- def image_exists (name ):
145
- images = find_images (name )
146
- return images and images [0 ].strip () == name
147
-
148
-
149
135
@pytest .fixture (scope = "module" )
150
136
def run_trino ():
151
137
image_tag = os .environ .get ("TRINO_IMAGE" )
@@ -160,69 +146,3 @@ def run_trino():
160
146
161
147
def trino_version ():
162
148
return TRINO_VERSION
163
-
164
-
165
- @click .group ()
166
- def cli ():
167
- pass
168
-
169
-
170
- @click .option (
171
- "--cache/--no-cache" , default = True , help = "enable/disable Docker build cache"
172
- )
173
- @click .command ()
174
- def trino_server ():
175
- container_id , _ , _ , _ = start_trino_and_wait ()
176
-
177
-
178
- @click .argument ("container_id" , required = False )
179
- @click .command ()
180
- def trino_cli (container_id = None ):
181
- if not container_id :
182
- container_id = os .environ .get ("TRINO_CONTAINER" )
183
- if not container_id :
184
- raise ValueError ("no container specified" )
185
- subprocess .call (
186
- [
187
- "docker" ,
188
- "exec" ,
189
- "-t" ,
190
- "-i" ,
191
- container_id ,
192
- "bin/trino-cli" ,
193
- "--server" ,
194
- "localhost:8080" ,
195
- ]
196
- )
197
-
198
-
199
- @cli .command ("list" )
200
- def list_ ():
201
- subprocess .check_call (
202
- ["docker" , "ps" , "--filter" , "name=trino-python-client-tests-" ]
203
- )
204
-
205
-
206
- @cli .command ()
207
- def clean ():
208
- 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
- )
214
- subprocess .check_output (cmd , shell = True )
215
-
216
-
217
- @cli .command ()
218
- def tests ():
219
- subprocess .check_call (["./tests_unit" ])
220
- subprocess .check_call (["./tests_integration" ])
221
-
222
-
223
- cli .add_command (trino_server )
224
- cli .add_command (trino_cli )
225
-
226
-
227
- if __name__ == "__main__" :
228
- cli ()
0 commit comments