Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[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
  • Loading branch information...
commit 62e587418cdfc8f54b6058072497df47e6ab3abd 1 parent e87ead6
@PaulMcMillan PaulMcMillan authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 tests/modeltests/custom_pk/tests.py
View
12 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 @@ def test_custom_fields_can_be_primary_keys(self):
# 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')
Please sign in to comment.
Something went wrong with that request. Please try again.