I was thinking about simple solution like this:

class UnitTest(unittest.TestCase):
    
    def setUp(self):
        global TEST_DB_INITED
        if not TEST_DB_INITED:
            TEST_DB_INITED = True            
            models.init_db(load_settings())            

    def tearDown(self):
        DBSession.remove()
        

setUp database as usual, then rollback it. In log-file I see:

014-04-08 21:49:16,592 DEBUG [txn.140162610095872][MainThread] new 
transaction
2014-04-08 21:49:16,615 DEBUG [txn.140162610095872][MainThread] commit
2014-04-08 21:49:16,617 DEBUG [txn.140162610095872][MainThread] new 
transaction
2014-04-08 21:49:16,628 DEBUG [txn.140162610095872][MainThread] commit
2014-04-08 21:49:16,629 DEBUG [txn.140162610095872][MainThread] new 
transaction
2014-04-08 21:49:16,635 DEBUG [txn.140162610095872][MainThread] commit

strange, isn't it? from very beginning it starts transactions
then I see SQL statements, and finally

2014-04-08 21:49:16,652 INFO  [sqlalchemy.engine.base.Engine][MainThread] 
ROLLBACK

But this ROLLBACK does nothing - next test still sees objects created in 
previous test

What is wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to