Skip to content

Commit

Permalink
Enable peewee commit by default
Browse files Browse the repository at this point in the history
  • Loading branch information
klen committed Nov 23, 2015
1 parent 8850599 commit 1f7a724
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions mixer/backend/peewee.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ class Mixer(BaseMixer):

type_mixer_cls = TypeMixer

def __init__(self, **params):
"""Initialize the Mixer instance."""
params.setdefault('commit', True)
super(Mixer, self).__init__(**params)

def postprocess(self, target):
""" Save objects in db.
Expand Down
4 changes: 2 additions & 2 deletions tests/test_peewee.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def test_mixer(mixer):
assert pet.animal_type
assert pet.owner

with mixer.ctx(commit=True):
with mixer.ctx(commit=False):
person = mixer.blend(Person)
assert person.id == 1
assert person.id


def test_guard(mixer):
Expand Down

0 comments on commit 1f7a724

Please sign in to comment.