Skip to content

Commit dd9a432

Browse files
committed
working commit 2
1 parent f507bb5 commit dd9a432

File tree

1 file changed

+38
-3
lines changed

1 file changed

+38
-3
lines changed

test/unified_format.py

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,43 @@ def setUp(self):
201201
for data in initial_data:
202202
self.insert_initial_data(self.client, data)
203203

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)
206241

207242
def run_scenario(self, spec):
208243
# process test-level runOnRequirements
@@ -216,7 +251,7 @@ def run_scenario(self, spec):
216251
raise unittest.SkipTest('%s' % (skip_reason,))
217252

218253
# process operations
219-
# TODO: process operations
254+
self.run_operations(spec['operations'])
220255

221256
# process expectedEvents
222257
# TODO: process expectedEvents

0 commit comments

Comments
 (0)