Fix recent flaky test for python 3.6
This commit is contained in:
parent
7247b9b68e
commit
7cea2a768f
@ -808,7 +808,7 @@ class Document(six.with_metaclass(TopLevelDocumentMetaclass, BaseDocument)):
|
|||||||
db.drop_collection(col_name)
|
db.drop_collection(col_name)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _create_index(cls, keys, background=False, **kwargs):
|
def create_index(cls, keys, background=False, **kwargs):
|
||||||
"""Creates the given indexes if required.
|
"""Creates the given indexes if required.
|
||||||
|
|
||||||
:param keys: a single index key or a list of index keys (to
|
:param keys: a single index key or a list of index keys (to
|
||||||
@ -851,7 +851,7 @@ class Document(six.with_metaclass(TopLevelDocumentMetaclass, BaseDocument)):
|
|||||||
warnings.warn(msg, DeprecationWarning)
|
warnings.warn(msg, DeprecationWarning)
|
||||||
elif not IS_PYMONGO_3:
|
elif not IS_PYMONGO_3:
|
||||||
kwargs.update({'drop_dups': drop_dups})
|
kwargs.update({'drop_dups': drop_dups})
|
||||||
return cls._create_index(key_or_list, background=background, **kwargs)
|
return cls.create_index(key_or_list, background=background, **kwargs)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def ensure_indexes(cls):
|
def ensure_indexes(cls):
|
||||||
|
@ -611,7 +611,11 @@ class IndexesTest(unittest.TestCase):
|
|||||||
|
|
||||||
with self.assertRaises(OperationFailure) as ctx_err:
|
with self.assertRaises(OperationFailure) as ctx_err:
|
||||||
Blog(id='garbage').save()
|
Blog(id='garbage').save()
|
||||||
self.assertIn("The field 'unique' is not valid for an _id index specification", str(ctx_err.exception))
|
try:
|
||||||
|
self.assertIn("The field 'unique' is not valid for an _id index specification", str(ctx_err.exception))
|
||||||
|
except AssertionError:
|
||||||
|
# error is slightly different on python 3.6
|
||||||
|
self.assertIn("The field 'background' is not valid for an _id index specification", str(ctx_err.exception))
|
||||||
|
|
||||||
@requires_mongodb_lte_32
|
@requires_mongodb_lte_32
|
||||||
def test_primary_key_unique_working_under_mongo_32(self):
|
def test_primary_key_unique_working_under_mongo_32(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user