@@ -47,25 +47,19 @@ def environ() -> Environ:
4747
4848
4949def graphql_url (environ : str ) -> str :
50- return "https://app.replicated-6bd9012.labelbox.dev/api/_gql"
51- """
5250 if environ == Environ .PROD :
5351 return 'https://api.labelbox.com/graphql'
5452 elif environ == Environ .STAGING :
5553 return 'https://staging-api.labelbox.com/graphql'
5654 return 'http://host.docker.internal:8080/graphql'
57- """
5855
5956
6057def testing_api_key (environ : str ) -> str :
61- return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJja3RhbXFnN2MwMDAxMHljaTAxZDFhaGVqIiwib3JnYW5pemF0aW9uSWQiOiJja3RhbXFnNm4wMDAwMHljaTgwaDI1NXZ3IiwiYXBpS2V5SWQiOiJja3RhbXZmdm4wMDhrMHljaTh1MG40a2hzIiwic2VjcmV0IjoiNzcxOWViMjgyNjUyMWMxODQ5MmJhMjg1NzhmY2FmNDEiLCJpYXQiOjE2MzEwNTMwNDksImV4cCI6MjI2MjIwNTA0OX0.yBLurIRB3xYQkV8MEBm0_LxmdqP9U-8aMj25kASmGLw"
62- """
6358 if environ == Environ .PROD :
6459 return os .environ ["LABELBOX_TEST_API_KEY_PROD" ]
6560 elif environ == Environ .STAGING :
6661 return os .environ ["LABELBOX_TEST_API_KEY_STAGING" ]
6762 return os .environ ["LABELBOX_TEST_API_KEY_LOCAL" ]
68- """
6963
7064
7165def cancel_invite (client , invite_id ):
@@ -140,11 +134,8 @@ def client(environ: str):
140134
141135
142136@pytest .fixture (scope = "session" )
143- def image_url (client , environ : str ):
144- return IMG_URL
145- #if environ == Environ.LOCAL:
146- # return IMG_URL
147- #return client.upload_data(requests.get(IMG_URL).content, sign=True)
137+ def image_url (client ):
138+ return client .upload_data (requests .get (IMG_URL ).content , sign = True )
148139
149140
150141@pytest .fixture
@@ -221,9 +212,16 @@ def datarow(dataset, image_url):
221212@pytest .fixture
222213def label_pack (project , rand_gen , image_url ):
223214 client = project .client
215+ < << << << HEAD
216+ dataset = client .create_dataset (name = rand_gen (str ))
217+ project .datasets .connect (dataset )
218+ data_row = dataset .create_data_row (row_data = IMG_URL )
219+ == == == =
224220 dataset = client .create_dataset (name = rand_gen (str ), projects = project )
225221 data_row = dataset .create_data_row (row_data = image_url )
222+ >> >> >> > 6970 d60beebc6c969a81c891b4c88db7c57f98df
226223 label = project .create_label (data_row = data_row , label = rand_gen (str ))
224+ time .sleep (10 )
227225 yield LabelPack (project , dataset , data_row , label )
228226 dataset .delete ()
229227
@@ -318,7 +316,7 @@ def submit(project_id, data_row_id):
318316 })
319317 features = feature_result ['project' ]['featuresForDataRow' ]
320318 feature_ids = [feature ['id' ] for feature in features ]
321- res = client .execute (
319+ client .execute (
322320 """mutation createLabelPyApi ($project_id : ID!,$datarow_id: ID!,$feature_ids: [ID!]!,$time_seconds : Float!) {
323321 createLabelFromFeatures(data: {dataRow: { id: $datarow_id },project: { id: $project_id },
324322 featureIds: $feature_ids,secondsSpent: $time_seconds}) {id}}""" ,
@@ -328,7 +326,6 @@ def submit(project_id, data_row_id):
328326 "feature_ids" : feature_ids ,
329327 "time_seconds" : 10
330328 })
331- return res ['createLabelFromFeatures' ]['id' ]
332329
333330 return submit
334331
@@ -365,8 +362,9 @@ def configured_project_with_label(client, rand_gen, annotation_submit_fn,
365362 upload_task = MALPredictionImport .create_from_objects (
366363 client , project .uid , f'mal-import-{ uuid .uuid4 ()} ' , predictions )
367364 upload_task .wait_until_done ()
368- labels = annotation_submit_fn (project .uid , data_row .uid )
369- time .sleep (3 )
370- yield [project , labels ]
365+ time .sleep (2 )
366+ annotation_submit_fn (project .uid , data_row .uid )
367+ time .sleep (2 )
368+ yield project
371369 dataset .delete ()
372370 project .delete ()
0 commit comments