Thursday, July 1, 2010

django.test.TestCase in external tests files (KeyError: 'SUPPORTS_TRANSACTIONS'")

Hi,

I'm trying to use django.test.TestCase class in my project's directory
"tests", e.g.

myapp/models.py
myapp/...
tests/sometest.py

If I use django TestCase inside sometest.py I get:

Traceback (most recent call last):
File "\django\django\test\testcases.py", line 256, in __call__
self._pre_setup()
File "\django\django\test\testcases.py", line 223, in _pre_setup
self._fixture_setup()
File "\django\django\test\testcases.py", line 486, in _fixture_setup
if not connections_support_transactions():
File "\django\django\test\testcases.py", line 475, in
connections_support_transactions
for conn in connections.all())
File "\django\django\test\testcases.py", line 475, in <genexpr>
for conn in connections.all())
KeyError: 'SUPPORTS_TRANSACTIONS'

But if I use it normally in the "myapp/tests.py", and command
"manage.py test myapp" it works just fine. Whats the problem here? I
would prefer to keep my tests outside the main package, and run them
manually without the manage.py (actually Eclipse runs tests directory
tests automatically).

My testing file currently is pretty simple:

from django.test import TestCase

class SomeTestCase(TestCase):
def test_something(self):
pass

Thanks.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment