File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
tests/modeltests/custom_pk Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
from django .test import TestCase
3
-
3
+ from django . utils . unittest import skipIf
4
4
from django .conf import settings
5
5
from django .db import transaction , IntegrityError , DEFAULT_DB_ALIAS
6
6
@@ -116,10 +116,10 @@ def test_custom_fields_can_be_primary_keys(self):
116
116
# SQLite lets objects be saved with an empty primary key, even though an
117
117
# integer is expected. So we can't check for an error being raised in that case
118
118
# 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" )
119
121
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' )
125
125
You can’t perform that action at this time.
0 commit comments