@@ -636,20 +636,17 @@ def organization(client):
636
636
637
637
638
638
@pytest .fixture
639
- def configured_project_with_label (
640
- client ,
641
- rand_gen ,
642
- image_url ,
643
- project ,
644
- dataset ,
645
- data_row ,
646
- wait_for_label_processing ,
647
- ):
639
+ def configured_project_with_label (client , rand_gen , dataset , data_row ,
640
+ wait_for_label_processing , teardown_helpers ):
648
641
"""Project with a connected dataset, having one datarow
642
+
649
643
Project contains an ontology with 1 bbox tool
650
644
Additionally includes a create_label method for any needed extra labels
651
645
One label is already created and yielded when using fixture
652
646
"""
647
+ project = client .create_project (name = rand_gen (str ),
648
+ queue_mode = QueueMode .Batch ,
649
+ media_type = MediaType .Image )
653
650
project ._wait_until_data_rows_are_processed (
654
651
data_row_ids = [data_row .uid ],
655
652
wait_processing_max_seconds = DATA_ROW_PROCESSING_WAIT_TIMEOUT_SECONDS ,
@@ -667,9 +664,7 @@ def configured_project_with_label(
667
664
)
668
665
yield [project , dataset , data_row , label ]
669
666
670
- client .delete_unused_ontology (ontology .uid )
671
- for label in project .labels ():
672
- label .delete ()
667
+ teardown_helpers .teardown_project_labels_ontology_feature_schemas (project )
673
668
674
669
675
670
def _create_label (project , data_row , ontology , wait_for_label_processing ):
@@ -1187,19 +1182,24 @@ def teardown_project_labels_ontology_feature_schemas(project: Project):
1187
1182
client = project .client
1188
1183
1189
1184
# featureSchemaIds = [tool.feature_schema_id for tool in ontology_builder.tools]
1190
- featureSchemaIds = [
1185
+ classification_feature_schema_ids = [
1191
1186
feature ["featureSchemaId" ]
1192
1187
for feature in ontology .normalized ["classifications" ]
1193
1188
]
1189
+ tool_feature_schema_ids = [
1190
+ feature ["featureSchemaId" ]
1191
+ for feature in ontology .normalized ["tools" ]
1192
+ ]
1194
1193
1194
+ feature_schema_ids = classification_feature_schema_ids + tool_feature_schema_ids
1195
1195
labels = list (project .labels ())
1196
1196
for label in labels :
1197
1197
label .delete ()
1198
1198
1199
1199
project .delete ()
1200
1200
client .delete_unused_ontology (ontology_id )
1201
- for featureSchemaId in featureSchemaIds :
1202
- project .client .delete_unused_feature_schema (featureSchemaId )
1201
+ for feature_schema_id in feature_schema_ids :
1202
+ project .client .delete_unused_feature_schema (feature_schema_id )
1203
1203
1204
1204
1205
1205
@pytest .fixture
0 commit comments