Commits

Anonymous committed 03289c0

Updated README and CHANGELOG

  • Participants
  • Parent commits 3838dd8

Comments (0)

Files changed (2)

File CHANGELOG.rst

 CHANGELOG
 =========
 
+Version 0.1.2
+
+- Made setting factoryoptions more flexible. It's now possible to change the
+  default flush/commit behavior of StormFactory per fixture class and or at
+  setup time when using the context manager syntax.
+
 Version 0.1.1
 
 - Bugfix: StormFactory did not flush/commit the store on fixture teardown
     class MyFixture(Fixture):
         product_2 = Factory(Product, desc='toy tractor')
 
+Flushing and commiting
+``````````````````````
+
+By default the StormFactory will call ``store.flush()`` at the end of setup,
+but will not commit. 
+This ensures that database generated values are populated,
+(eg autoincrement ids)
+but the fixture data will not be persisted 
+until you explicitly call ``store.commit()``.
+
+To change this behavior, override ``factoryoptions`` in your fixture class::
+
+  class MyFixture(Fixture):
+
+    factoryoptions = {'commit': True}
+
+This will cause all instances of your fixture
+to commit their objects after construction.
+
+If you want to vary factory options between test cases
+(eg if one test case requires the store to be commited,
+but you don't want it to be the default)
+you can supply factory options as keyword arguments
+when calling ``Fixture.setup``, eg::
+
+  self.f = MyFixture().setup(commit=True)
+
+Or if you are using the context manager syntax 
+you can supply factoryoptions in the fixture constructor, eg::
+
+  with MyFixture(factoryoptions={'commit': True}) as fixturedata:
+    ...
 
 Other ORMs
 ----------