2

I'm trying to be a good programmer and use Django's testing facility. things are going pretty well, but I would like to be able to examine the database when I stop the program in the debugger. It looks like the database work that I do in my setUp routines is wrapped in a transaction, so I can't see it from another session (I'm using a PostgreSQL back-end).

I've done some playing around and I don't have TransactionMiddleware installed. I tried decorating my functions with django.db.transactions.commit_on_success, but that is not helping.

Any thoughts?

4

2 に答える 2

1

おそらく、TestCase の代わりにTransactionTestCaseを使用すると役立つ場合があります。

于 2011-07-22T15:29:18.980 に答える
1

を使用している場合django.test.TestCaseDjango は各テストをトランザクションでラップし、テストの最後にロールバックします。TransactionTestCase代わりにサブクラス化する必要があります。

于 2011-07-22T15:30:40.600 に答える