restrict test on allowDiskUse to mongoDB >= 4.4 in CI + ran black
This commit is contained in:
parent
467e9c3ddf
commit
9ff5d8426c
@ -21,6 +21,7 @@ from mongoengine.queryset import (
|
|||||||
QuerySetManager,
|
QuerySetManager,
|
||||||
queryset_manager,
|
queryset_manager,
|
||||||
)
|
)
|
||||||
|
from tests.utils import requires_mongodb_gte_44
|
||||||
|
|
||||||
|
|
||||||
class db_ops_tracker(query_counter):
|
class db_ops_tracker(query_counter):
|
||||||
@ -5656,6 +5657,7 @@ class TestQueryset(unittest.TestCase):
|
|||||||
qs = self.Person.objects().timeout(False)
|
qs = self.Person.objects().timeout(False)
|
||||||
assert qs._cursor_args == {"no_cursor_timeout": True}
|
assert qs._cursor_args == {"no_cursor_timeout": True}
|
||||||
|
|
||||||
|
@requires_mongodb_gte_44
|
||||||
def test_allow_disk_use(self):
|
def test_allow_disk_use(self):
|
||||||
qs = self.Person.objects()
|
qs = self.Person.objects()
|
||||||
assert qs._cursor_args == {}
|
assert qs._cursor_args == {}
|
||||||
@ -5681,6 +5683,5 @@ class TestQueryset(unittest.TestCase):
|
|||||||
assert qs_disk[index] == qs[index]
|
assert qs_disk[index] == qs[index]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import operator
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -33,6 +34,10 @@ def get_as_pymongo(doc):
|
|||||||
return doc.__class__.objects.as_pymongo().get(id=doc.id)
|
return doc.__class__.objects.as_pymongo().get(id=doc.id)
|
||||||
|
|
||||||
|
|
||||||
|
def requires_mongodb_gte_44(func):
|
||||||
|
return _decorated_with_ver_requirement(func, (4, 4), oper=operator.ge)
|
||||||
|
|
||||||
|
|
||||||
def _decorated_with_ver_requirement(func, mongo_version_req, oper):
|
def _decorated_with_ver_requirement(func, mongo_version_req, oper):
|
||||||
"""Return a MongoDB version requirement decorator.
|
"""Return a MongoDB version requirement decorator.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user