Open mockingjet opened 2 years ago
I found that although I set sqlalchemy_session_persistence = "commit" in my BaseFactory, factory_boy doesn't commit changes after executing post_generation wrapped method. I have to commit changes in the end by myself.
@rbarrois Is not committing changes in @post_generaion intended?
I inspect the code and see that factory_boy working with django has this
# factory/django.py
# line: 168
@classmethod
def _after_postgeneration(cls, instance, create, results=None):
"""Save again the instance if creating and at least one hook ran."""
if create and results:
# Some post-generation hooks ran, and may have modified us.
instance.save()
On the other hand, I don't see the similar implementation in factory/alchemy.py.
Hello @rbarrois. after 3 years I still find this occur. Is it intentional to let developers explicitly commit postgeneration by themselves?
Although both object has relationship in orm, no real record created in table "assoc_managers_roles" How to create real many to many relationship with factory_boy ?