Skip to content

Commit 9180b89

Browse files
committed
remove pymongo 2.x compatibility in tests
1 parent ec56509 commit 9180b89

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

flask_pymongo/tests/test_wrappers.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from werkzeug.exceptions import HTTPException
2-
import pymongo
32

43
from flask_pymongo.tests.util import FlaskPyMongoTest
54

@@ -14,10 +13,7 @@ def test_find_one_or_404(self):
1413
except HTTPException as notfound:
1514
assert notfound.code == 404, "raised wrong exception"
1615

17-
if pymongo.version_tuple[0] > 2:
18-
self.mongo.db.things.insert_one({"_id": "thing", "val": "foo"})
19-
else:
20-
self.mongo.db.things.insert({"_id": "thing", "val": "foo"}, w=1)
16+
self.mongo.db.things.insert_one({"_id": "thing", "val": "foo"})
2117

2218
# now it should not raise
2319
thing = self.mongo.db.things.find_one_or_404({"_id": "thing"})
@@ -30,11 +26,7 @@ def test_find_one_or_404(self):
3026
except HTTPException as notfound:
3127
assert notfound.code == 404, "raised wrong exception"
3228

33-
if pymongo.version_tuple[0] > 2:
34-
# Write Concern is set to w=1 by default in pymongo > 3.0
35-
self.mongo.db.things.morethings.insert_one({"_id": "thing", "val": "foo"})
36-
else:
37-
self.mongo.db.things.morethings.insert({"_id": "thing", "val": "foo"}, w=1)
29+
self.mongo.db.things.morethings.insert_one({"_id": "thing", "val": "foo"})
3830

3931
# now it should not raise
4032
thing = self.mongo.db.things.morethings.find_one_or_404({"_id": "thing"})

0 commit comments

Comments
 (0)