diff --git a/tests/queryset/geo.py b/tests/queryset/geo.py index dad51132..12e96a04 100644 --- a/tests/queryset/geo.py +++ b/tests/queryset/geo.py @@ -1,14 +1,16 @@ import sys -from mongoengine.connection import get_connection sys.path[0:0] = [""] import unittest from datetime import datetime, timedelta -from mongoengine import * +from pymongo.errors import OperationFailure +from mongoengine import * +from mongoengine.connection import get_connection from nose.plugins.skip import SkipTest + __all__ = ("GeoQueriesTest",) @@ -175,6 +177,13 @@ class GeoQueriesTest(unittest.TestCase): points = Point.objects(location__near_sphere=[-122, 37.5], location__max_distance=60 / earth_radius) + # This test is sometimes failing with Mongo internals non-sense. + # See https://travis-ci.org/MongoEngine/mongoengine/builds/58729101 + try: + points.count() + except OperationFailure: + raise SkipTest("Sometimes MongoDB ignores its capacities on maxDistance") + self.assertEqual(points.count(), 2) # Finds both points, but orders the north point first because it's