I'm using Django 1.2.3 with Python 2.6.
I would like to use the new fancy unittest asserts available in Python
2.7. These have been backported to Python 2.6 as the unittest2 module
(http://www.voidspace.org.uk/python/articles/unittest2.shtml).
But at the same time, I would like to use test fixtures available in
django.test.TestCase. I saw that there are plans to upgrade to the new
unittest in Django 1.3 (http://code.djangoproject.com/ticket/12991).

I used this hack, and it seems to work so far:

-----
import django.test
import unittest2

class TestCase(django.test.TestCase, unittest2.TestCase):
    pass

class ExampleTest(TestCase):
    def testExample(self):
         self.assertGreater(3, 2)
--------

1. Does this break in unexpected ways? My guess is that all methods
which exist in django.test.TestCase are used first, and only those
assert* calls that are not found there will be taken from unittest2.
2. Is there a better way to combine django.test.TestCase and
unittest2, until Django 1.3 is released?

Thanks,

Mattias

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

Reply via email to