#32409: TestCase async tests are not transaction-aware
-------------------------------------+-------------------------------------
     Reporter:  David                |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Testing framework    |                  Version:  3.1
     Severity:  Normal               |               Resolution:
     Keywords:  TestCase, async,     |             Triage Stage:  Accepted
  transaction                        |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by David):

 Looking deeper at [https://github.com/pytest-dev/pytest-
 
django/blob/59fdb49fbc380bc09bcac65de8acab767194b553/pytest_django/fixtures.py#L126-L153
 pytest] integration I found that in my case it does not behave like
 `TestCase` but like `TransactionTestCase`.

 When using `TransactionTestCase` all my unit-tests pass.

 I have also add the "simple-fetch" test suggested by Carlton to my sample
 project tests along with automated testing to better see what is going on
 (results can be see [https://github.com/sevdog/test-websocker-user-
 lock/actions?query=workflow%3ATests here]).

 Usin sqlit3 tests fail due to this error:
 `django.db.utils.OperationalError: database table is locked:
 ws_lock_grouptypevisibility`. From what I have found this error is due to
 a concurrent connection with an uncommitted-transaction.

 So the whole problem seems to be bound to ''transactions'' and how they
 behave with async code. In a normal/production working flow this ''may''
 not be a problem, but while running tests it is.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32409#comment:13>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.3c2ae3a10d9de5d90a1c7b7795573444%40djangoproject.com.

Reply via email to