From 5c4ce8754e29d435a621a1780ef96c3a6bb60ebf Mon Sep 17 00:00:00 2001 From: Erdenezul Batmunkh Date: Mon, 2 Oct 2017 23:15:37 +0800 Subject: [PATCH] run tests only pymongo3 #1565 --- tests/test_connection.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_connection.py b/tests/test_connection.py index f0c272e4..f58b1a3e 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -365,9 +365,10 @@ class ConnectionTest(unittest.TestCase): self.assertEqual(d, date_doc.the_date) def test_read_preference_from_parse(self): - from pymongo import ReadPreference - conn = connect(host="mongodb://a1.vpc,a2.vpc,a3.vpc/prod?readPreference=secondaryPreferred") - self.assertEqual(conn.read_preference, ReadPreference.SECONDARY_PREFERRED) + if IS_PYMONGO_3: + from pymongo import ReadPreference + conn = connect(host="mongodb://a1.vpc,a2.vpc,a3.vpc/prod?readPreference=secondaryPreferred") + self.assertEqual(conn.read_preference, ReadPreference.SECONDARY_PREFERRED) def test_multiple_connection_settings(self): connect('mongoenginetest', alias='t1', host="localhost")