Author: PaulM
Date: 2010-07-02 12:19:17 -0500 (Fri, 02 Jul 2010)
New Revision: 13412

Modified:
   django/branches/soc2010/test-refactor/tests/modeltests/custom_pk/tests.py
Log:
[soc2010/test-refactor] updated custom_pk modeltest to take advantage of 
unittest2


Modified: 
django/branches/soc2010/test-refactor/tests/modeltests/custom_pk/tests.py
===================================================================
--- django/branches/soc2010/test-refactor/tests/modeltests/custom_pk/tests.py   
2010-07-02 16:34:41 UTC (rev 13411)
+++ django/branches/soc2010/test-refactor/tests/modeltests/custom_pk/tests.py   
2010-07-02 17:19:17 UTC (rev 13412)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 from django.test import TestCase
-
+from django.utils.unittest import skipIf
 from django.conf import settings
 from django.db import transaction, IntegrityError, DEFAULT_DB_ALIAS
 
@@ -116,10 +116,10 @@
     # SQLite lets objects be saved with an empty primary key, even though an
     # integer is expected. So we can't check for an error being raised in that 
case
     # for SQLite. Remove it from the suite for this next bit.
+    @skipIf(settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'] == 
'django.db.backends.sqlite3',
+            "SQLite lets objects be saved with empty pk")
     def test_empty_pk_error(self):
-        #fixme, improve this skiping with unittest2
-        if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'] != 
'django.db.backends.sqlite3':
-            self.assertRaises(IntegrityError,
-                              Employee.objects.create,
-                              first_name='Tom', last_name='Smith')
+        self.assertRaises(IntegrityError,
+                          Employee.objects.create,
+                          first_name='Tom', last_name='Smith')
             

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

Reply via email to