Skip to content

Commit 62e5874

Browse files
committed
[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
1 parent e87ead6 commit 62e5874

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/modeltests/custom_pk/tests.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
from django.test import TestCase
3-
3+
from django.utils.unittest import skipIf
44
from django.conf import settings
55
from django.db import transaction, IntegrityError, DEFAULT_DB_ALIAS
66

@@ -116,10 +116,10 @@ def test_custom_fields_can_be_primary_keys(self):
116116
# SQLite lets objects be saved with an empty primary key, even though an
117117
# integer is expected. So we can't check for an error being raised in that case
118118
# for SQLite. Remove it from the suite for this next bit.
119+
@skipIf(settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'] == 'django.db.backends.sqlite3',
120+
"SQLite lets objects be saved with empty pk")
119121
def test_empty_pk_error(self):
120-
#fixme, improve this skiping with unittest2
121-
if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'] != 'django.db.backends.sqlite3':
122-
self.assertRaises(IntegrityError,
123-
Employee.objects.create,
124-
first_name='Tom', last_name='Smith')
122+
self.assertRaises(IntegrityError,
123+
Employee.objects.create,
124+
first_name='Tom', last_name='Smith')
125125

0 commit comments

Comments
 (0)