Skip to content

Commit 8ca4b0e

Browse files
committed
Fix _require
1 parent 8e6a30d commit 8ca4b0e

File tree

4 files changed

+14
-22
lines changed

4 files changed

+14
-22
lines changed

test/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -464,11 +464,12 @@ def wrap(*args, **kwargs):
464464
if not self.connected:
465465
pair = self.pair
466466
raise SkipTest(f"Cannot connect to MongoDB on {pair}")
467-
if iscoroutinefunction(condition) and condition():
468-
if wraps_async:
469-
return f(*args, **kwargs)
470-
else:
471-
return f(*args, **kwargs)
467+
if iscoroutinefunction(condition):
468+
if condition():
469+
if wraps_async:
470+
return f(*args, **kwargs)
471+
else:
472+
return f(*args, **kwargs)
472473
elif condition():
473474
if wraps_async:
474475
return f(*args, **kwargs)

test/asynchronous/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -466,11 +466,12 @@ async def wrap(*args, **kwargs):
466466
if not self.connected:
467467
pair = await self.pair
468468
raise SkipTest(f"Cannot connect to MongoDB on {pair}")
469-
if iscoroutinefunction(condition) and await condition():
470-
if wraps_async:
471-
return await f(*args, **kwargs)
472-
else:
473-
return f(*args, **kwargs)
469+
if iscoroutinefunction(condition):
470+
if await condition():
471+
if wraps_async:
472+
return await f(*args, **kwargs)
473+
else:
474+
return f(*args, **kwargs)
474475
elif condition():
475476
if wraps_async:
476477
return await f(*args, **kwargs)

test/asynchronous/utils_spec_runner.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,24 +180,19 @@ def serverless_ok(run_on_req):
180180

181181
async def should_run_on(self, scenario_def):
182182
run_on = scenario_def.get("runOn", [])
183-
print(f"RUN_ON: {run_on}")
184183
if not run_on:
185184
# Always run these tests.
186185
return True
187186

188187
for req in run_on:
189-
print(f"REQ: {req}")
190188
if (
191189
await self.valid_topology(req)
192190
and self.min_server_version(req)
193191
and self.max_server_version(req)
194192
and self.valid_auth_enabled(req)
195193
and self.serverless_ok(req)
196194
):
197-
print(f"REQ passes: {req}")
198195
return True
199-
else:
200-
print(f"REQ fails: {req}")
201196
return False
202197

203198
def ensure_run_on(self, scenario_def, method):
@@ -206,7 +201,7 @@ def ensure_run_on(self, scenario_def, method):
206201
async def predicate():
207202
return await self.should_run_on(scenario_def)
208203

209-
return async_client_context._require(lambda: predicate, "runOn not satisfied", method)
204+
return async_client_context._require(predicate, "runOn not satisfied", method)
210205

211206
def tests(self, scenario_def):
212207
"""Allow CMAP spec test to override the location of test."""

test/utils_spec_runner.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,24 +180,19 @@ def serverless_ok(run_on_req):
180180

181181
def should_run_on(self, scenario_def):
182182
run_on = scenario_def.get("runOn", [])
183-
print(f"RUN_ON: {run_on}")
184183
if not run_on:
185184
# Always run these tests.
186185
return True
187186

188187
for req in run_on:
189-
print(f"REQ: {req}")
190188
if (
191189
self.valid_topology(req)
192190
and self.min_server_version(req)
193191
and self.max_server_version(req)
194192
and self.valid_auth_enabled(req)
195193
and self.serverless_ok(req)
196194
):
197-
print(f"REQ passes: {req}")
198195
return True
199-
else:
200-
print(f"REQ fails: {req}")
201196
return False
202197

203198
def ensure_run_on(self, scenario_def, method):
@@ -206,7 +201,7 @@ def ensure_run_on(self, scenario_def, method):
206201
def predicate():
207202
return self.should_run_on(scenario_def)
208203

209-
return client_context._require(lambda: predicate, "runOn not satisfied", method)
204+
return client_context._require(predicate, "runOn not satisfied", method)
210205

211206
def tests(self, scenario_def):
212207
"""Allow CMAP spec test to override the location of test."""

0 commit comments

Comments
 (0)