@@ -201,8 +201,43 @@ def setUp(self):
201
201
for data in initial_data :
202
202
self .insert_initial_data (self .client , data )
203
203
204
- # initialize internals
205
- self .test_assets = {}
204
+ # PyMongo internals
205
+ #self.test_assets = {}
206
+
207
+ def run_entity_operation (self , entity_name , spec ):
208
+ target = self .entity_map [entity_name ]
209
+ opname = camel_to_snake (spec ['name' ])
210
+ opargs = spec .get ('arguments' )
211
+ expect_error = spec .get ('expectError' )
212
+ if expect_error :
213
+ # TODO: process expectedError object
214
+ # See L420-446 of utils_spec_runner.py
215
+ pass
216
+ else :
217
+ # Operation expected to succeed
218
+ arguments = {}
219
+ if opargs :
220
+ if 'session' in arguments :
221
+ # TODO: resolve session to entity
222
+ pass
223
+ if 'readConcern' in arguments :
224
+ from pymongo .read_concern import ReadConcern
225
+ arguments ['read_concern' ] = ReadConcern (
226
+ ** opargs .pop ('readConcern' ))
227
+ if 'readPreference' in arguments :
228
+ from pymongo .read_preferences import ReadPreference
229
+ pass
230
+
231
+ def run_special_operation (self , spec ):
232
+ pass
233
+
234
+ def run_operations (self , spec ):
235
+ for op in spec :
236
+ target = op ['object' ]
237
+ if target != 'testRunner' :
238
+ self .run_entity_operation (target , op )
239
+ else :
240
+ self .run_special_operation (op )
206
241
207
242
def run_scenario (self , spec ):
208
243
# process test-level runOnRequirements
@@ -216,7 +251,7 @@ def run_scenario(self, spec):
216
251
raise unittest .SkipTest ('%s' % (skip_reason ,))
217
252
218
253
# process operations
219
- # TODO: process operations
254
+ self . run_operations ( spec [ ' operations' ])
220
255
221
256
# process expectedEvents
222
257
# TODO: process expectedEvents
0 commit comments