django-test-utils
django-test-utils copied to clipboard
KeyError: 'SUPPORTS_TRANSACTIONS'
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'
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?
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
Same problem running django 1.2 beta and mysql
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
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
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
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.