Closed jone closed 11 years ago
What is the intention to configure the builder within ftw.builder
and not inside the individual projects?
The intention is to make it easy to use ftw.builder in functional tests without breaking test isolation.
When configuring the session in the a package specific fixture and using the this fixture for integration and functional testing (as it is done when using plone.app.testing
the way it's meant to be used) it will result in commits in integration testing. This would cause bugs which are hard to trace.
Would you prefer to remove the auto_commit
feature altogether?
I'd either give the user a tool to do it right or let him do transaction.commit
's manually..
Why not turn auto-commit off by default?
It is off by default, but if you just turn it on in setUp
of the layer the isolation is gone
maybe we should reevaluate the singleton approach... calling that reset
method seems like a smell to me.
@senny Update:
BUILDER_LAYER
which should always be usedset_builder_session_factory
for changing the session factory with a testing layer (e.g. only for functional testing)looks great! This should go into the README ( #5 ) as well.
The zope.testing.cleanup functionality does not work for our use case: when using functional and integration testing with the same layer the cleanup is ran once after executing both, which might result in auto_commit enabled for the integration testing layer.
The BUILDER_AUTO_COMMIT layer resets the session after each test, which fixes the problem. But it the session is not reset when not using the BUILDER_AUTO_COMMIT.
(I'm working on the readme on a seperate branch, I'll document it there until it is in master too). /cc @senny @phgross