First thing, I'd like to thank you for the release.

Second thing, I'd also love if somebody could help me understanding why 
all my unittests are failing after the upgrade  :-))


Basically, it seems like the transactions are not rolled back.

I use SQLAlchemy. I create the test db, complete with data, once at the 
beginning of the test run, then I rollback after each single test.
I make heavy use of triggers and autoload, so I'd rather avoid using 
SQLite for tests.
Re-creating the whole db upon each unittest would be too slow.

Everything worked on TG 1.0.2.2


I subclass my _model_ test cases from:


> from turbogears.database import session
>
> class DBTestCase(unittest.TestCase):
>     transaction = None
>
>     def setUp(self):
>         # In case of errors, we clear here the session and 
> transaction, or other tests will fail
>         if self.transaction:
>             self.transaction.rollback()
>             self.transaction = None
>         session.clear()
>         self.transaction = session.create_transaction()
>
>     def tearDown(self):
>         # Hit the db before rollback
>         # This way, we catch some integrity errors, type checking from 
> sqlalchemy, and the like
>         session.flush()
>         self.transaction.rollback()
>         self.transaction = None
>         session.clear()


Moreover, I subclass _functional_ tests from:
> from cherrypy._cpwsgi import wsgiApp
> from twill import wsgi_intercept
>
> class WSGITest(DBTestCase):
>     def setUp(self):
>         super(WSGITest, self).setUp()
>         wsgi_intercept.add_wsgi_intercept('localhost', 80, lambda: 
> wsgiApp)
>
>     def tearDown(self):
>         wsgi_intercept.remove_wsgi_intercept('localhost', 80)
>         super(WSGITest, self).tearDown()


All model and functional tests are failing on 1.0.3, raising duplicate 
key errors and the like, so I guess the problem is with DBTestCase.

I'm about to delve deeper into this, but I wonder if I'm missing a 
simpler way to achieve the same purpose.

Is there anybody who rollbacks the db changes after each test, on 
SQLAlchemy?



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to