You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This means that the context is also swallowing the AssertionError being actually raised from the tests...
The following piece of code is not working since at least 0.10.0:
In [1]: import mongoengine as me
...: me.connect()
...:
...: class Ref(me.Document):
...: whatever = me.StringField()
...:
...: class Doc(me.Document):
...: ref = me.ReferenceField(Ref)
...:
...: ref = Ref(whatever='').save()
...: Doc(ref=ref).save()
...:
...: with me.context_managers.no_dereference(Doc):
...: print Doc.objects().first().ref # should be a DBRef but is a 'Ref object...'
Ref object
In [2]: Doc.objects().no_dereference().first().ref
Out[2]: DBRef('ref', ObjectId('5b8b07714ec5dc0d752d504b')) # fine
I'll push a PR shortly
The text was updated successfully, but these errors were encountered:
bagerard
changed the title
Context managers no_dereference & no_sub_classes are very buggy
Context managers no_dereference & no_sub_classes are very buggy and potentially not thread-safe
Sep 1, 2018
bagerard
changed the title
Context managers no_dereference & no_sub_classes are very buggy and potentially not thread-safe
no_dereference context manager is not working
Sep 1, 2018
with no_dereference(Group) as NoDeRefGroup:
Group is NoDeRefGroup # True!
I find this confusing because the user might think that he can mess around with the NoDeRefGroup class but he is actually using Group. May I remove the "as ..." construct (breaking change)?
The no_dereference context manager suffers from the same issue as the no_subclasses context (#1865) regarding its _exit_ https://github.com/MongoEngine/mongoengine/blob/master/mongoengine/context_managers.py#L130, which means that any exceptions raised during the context gets silenced...
This means that the context is also swallowing the AssertionError being actually raised from the tests...
The following piece of code is not working since at least 0.10.0:
I'll push a PR shortly
The text was updated successfully, but these errors were encountered: