Skip to content

Commit 9ff5d84

Browse files
committed
restrict test on allowDiskUse to mongoDB >= 4.4 in CI + ran black
1 parent 467e9c3 commit 9ff5d84

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

tests/queryset/test_queryset.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
QuerySetManager,
2222
queryset_manager,
2323
)
24+
from tests.utils import requires_mongodb_gte_44
2425

2526

2627
class db_ops_tracker(query_counter):
@@ -5656,6 +5657,7 @@ def test_no_cursor_timeout(self):
56565657
qs = self.Person.objects().timeout(False)
56575658
assert qs._cursor_args == {"no_cursor_timeout": True}
56585659

5660+
@requires_mongodb_gte_44
56595661
def test_allow_disk_use(self):
56605662
qs = self.Person.objects()
56615663
assert qs._cursor_args == {}
@@ -5681,6 +5683,5 @@ def test_allow_disk_use(self):
56815683
assert qs_disk[index] == qs[index]
56825684

56835685

5684-
56855686
if __name__ == "__main__":
56865687
unittest.main()

tests/utils.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import operator
12
import unittest
23

34
import pytest
@@ -33,6 +34,10 @@ def get_as_pymongo(doc):
3334
return doc.__class__.objects.as_pymongo().get(id=doc.id)
3435

3536

37+
def requires_mongodb_gte_44(func):
38+
return _decorated_with_ver_requirement(func, (4, 4), oper=operator.ge)
39+
40+
3641
def _decorated_with_ver_requirement(func, mongo_version_req, oper):
3742
"""Return a MongoDB version requirement decorator.
3843

0 commit comments

Comments
 (0)