Re: [sqlalchemy] Rolling back all changes between unit tests

2013-07-24 Thread Pau Tallada
Hi! A successful commit cannot be rolled back. Do not use commit. Use session.flush instead, then you could use rollback to revert changes. Cheers, Pau. 2013/7/23 Ib Lundgren ib.lundg...@gmail.com Hey all, I'd like to have a clean DB between tests, one approach that works is to drop

Re: [sqlalchemy] Rolling back all changes between unit tests

2013-07-24 Thread Ladislav Lenart
Hello. I am not familiar with the usage of nested transactions, though I am pretty sure what you want is possible. I would like to suggest a simpler approach. If you implement all your functions without commit and move the commit to one place (e.g. to the end of a web request processing), you

[sqlalchemy] Rolling back all changes between unit tests

2013-07-23 Thread Ib Lundgren
Hey all, I'd like to have a clean DB between tests, one approach that works is to drop tables and recreate fixtures. This can be quite slow and I'd rather have something more lean. If possible I'd like to create a snapshot before each test and rollback to the snapshot after each test. From