django-test-utils icon indicating copy to clipboard operation
django-test-utils copied to clipboard

KeyError: 'SUPPORTS_TRANSACTIONS'

Open ramusus opened this issue 15 years ago • 7 comments

When I try to execute quicktest with specific app I get error:

ram@ram-laptop:~/workspace/movister/web_site$ ./manage.py quicktest movister
E
Traceback (most recent call last):
  File "/home/ram/workspace/movister/web_site/django/test/testcases.py", line 256, in __call__
    self._pre_setup()
  File "/home/ram/workspace/movister/web_site/django/test/testcases.py", line 223, in _pre_setup
    self._fixture_setup()
  File "/home/ram/workspace/movister/web_site/django/test/testcases.py", line 461, in _fixture_setup
    if not connections_support_transactions():
  File "/home/ram/workspace/movister/web_site/django/test/testcases.py", line 450, in connections_support_transactions
    for conn in connections.all())
  File "/home/ram/workspace/movister/web_site/django/test/testcases.py", line 450, in <genexpr>
    for conn in connections.all())
KeyError: 'SUPPORTS_TRANSACTIONS'

DB - Postgres 8.4

DATABASE_ENGINE = 'postgresql_psycopg2'

ramusus avatar Jan 10 '10 09:01 ramusus

Hmm, wonder if this is related to multidb? It works under my setup with postgres 8.3. What version of django are you running against?

ericholscher avatar Jan 18 '10 02:01 ericholscher

I use development version of django from trunk. I tried another time with r12228 - error still here. Also my version of postgres is 8.4

ramusus avatar Jan 18 '10 16:01 ramusus

Same problem running django 1.2 beta and mysql

phoebebright avatar Mar 31 '10 10:03 phoebebright

It was a fairly easy patch to get this working with Django 1.2

Download here: http://iwcenter.com/files/0001-Made-this-work-against-django-1.2.patch

joelryan2k avatar Apr 29 '10 15:04 joelryan2k

Thanks for the patch joel, I applied it to a 1.2 compat branch. I don't know a good way of supporting this on both versions, I guess just a bunch of if statements and such. I'll hopefully look more at it this weekend and get it into trunk so it'll work on 1.1 and 1.2

ericholscher avatar Apr 30 '10 22:04 ericholscher

joelryan2k's patch didn't work for my particular postgres installation. The cursor = connection.cursor() line in the try block was returning a cursor for my main db not the test db. And thus the create_test_db() was never getting called.

When I added connection.close() to the line before then I was getting an exception, but it was an OperationalError, not a DatabaseError. My temp solution is to make the except block catch ALL exceptions. Not great but it works.

Also I'm running Django 1.2.1 release and Postgres 8.4

denivorium avatar Jun 14 '10 22:06 denivorium

I just created a brand new Django 1.2.3 project with a sqlite3 database, ran its one default test, and got the same error.

arowla avatar Oct 14 '10 21:10 arowla