How to get Django unittest to commit / save data in a database

I am debugging a big unittest test for django and would like to use my usual debugging tools:

  • looking at db in admin django via runerver
  • view in db manually.

None of them work because unittest did not commit the transaction on which the db bit is executed.

The obvious solution is to simply tell unittest not to use the transaction, or to force it to commit somehow. Another way is to create a custom settings file that allows the launch server to connect to the transaction. But the first idea seems to be that it should be very easy. Any ideas? I am using MySQL and django 1.3.1

+3
source share
1 answer

TransactionTestCase , TestCase. TransactionTestCase TestCase, , .

, unit test , , , , . A unit test , , . . Carl Meyer Pycon 2012 Django .

+6

All Articles