#20382: random TransactionManagementError during tests in _fixture_setup
-------------------------------------+-------------------------------------
     Reporter:  joao@…               |      Owner:  nobody
         Type:  Bug                  |     Status:  new
    Component:  Database layer       |    Version:  1.5
  (models, ORM)                      |   Keywords:
     Severity:  Normal               |  TransactionManagementError
 Triage Stage:  Unreviewed           |  Has patch:  0
Easy pickings:  0                    |      UI/UX:  0
-------------------------------------+-------------------------------------
 Automated Django 1.5.1 tests randomly fail with
 **TransactionManagementError**. It is hard to track down because a failed
 test can run again, without any changes, and pass.

 I am NOT using the **@transaction.commit_manually** decorator and am aware
 of the need for manual commit/rollback when it is used.

 One view does have the **@transaction.commit_on_success** decorator. It
 does NOT have any commands for manual commit/rollback and from the docs I
 believe this is correct. But this might be irrelevant:
 1. the view is not called in every fail case
 1. error raised during fixture setup

 Test database is set to django.db.backends.sqlite3

 {{{
 Traceback (most recent call last):
   File "/usr/lib64/python2.7/site-packages/django/test/testcases.py", line
 259, in __call__
     self._pre_setup()
   File "/usr/lib64/python2.7/site-packages/django/test/testcases.py", line
 479, in _pre_setup
     self._fixture_setup()
   File "/usr/lib64/python2.7/site-packages/django/test/testcases.py", line
 518, in _fixture_setup
     **{'verbosity': 0, 'database': db_name, 'skip_validation': True})
   File "/usr/lib64/python2.7/site-
 packages/django/core/management/__init__.py", line 161, in call_command
     return klass.execute(*args, **defaults)
   File "/usr/lib64/python2.7/site-
 packages/django/core/management/base.py", line 255, in execute
     output = self.handle(*args, **options)
   File "/usr/lib64/python2.7/site-
 packages/django/core/management/commands/loaddata.py", line 234, in handle
     transaction.leave_transaction_management(using=using)
   File "/usr/lib64/python2.7/site-packages/django/db/transaction.py", line
 66, in leave_transaction_management
     connection.leave_transaction_management()
   File "/usr/lib64/python2.7/site-
 packages/django/db/backends/__init__.py", line 131, in
 leave_transaction_management
     "This code isn't under transaction management")
 TransactionManagementError: This code isn't under transaction management
 }}}

 == Selenium Tests ==
 * Using Selenium webdriver 2.32.0 (latest)
 * BrowserTestCase extends django.test.LiveServerTestCase
 * Test classes extend BrowserTestCase and inherit the same fixtures

 == Unit Tests ==
 * Error does NOT occur for tests extending django.test.TestCase or
 django.utils.unittest
 * Use the same fixtures as above

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20382>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to