From 62e587418cdfc8f54b6058072497df47e6ab3abd Mon Sep 17 00:00:00 2001 From: Paul McMillan Date: Fri, 2 Jul 2010 17:19:17 +0000 Subject: [PATCH] [soc2010/test-refactor] updated custom_pk modeltest to take advantage of unittest2 git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2010/test-refactor@13412 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/modeltests/custom_pk/tests.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/modeltests/custom_pk/tests.py b/tests/modeltests/custom_pk/tests.py index cb6192a8d5..f724aeda93 100644 --- a/tests/modeltests/custom_pk/tests.py +++ b/tests/modeltests/custom_pk/tests.py @@ -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 @@ class CustomPkTestCase(TestCase): # 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')