mirror of https://github.com/django/django.git
Stopped a test from executing queries at the module level.
Currently module level queries are executed against the real database (specified in NAME) instead of the test database; since it is to late to fix this for 1.6, we at least ensures stable builds. Refs #21443.
This commit is contained in:
parent
e6c0020d19
commit
4fcc1e4ad8
|
@ -1,6 +1,6 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from unittest import skipIf, skipUnless
|
from unittest import skipIf, skipUnless, SkipTest
|
||||||
|
|
||||||
from django.db import (connection, connections, transaction, DEFAULT_DB_ALIAS, DatabaseError,
|
from django.db import (connection, connections, transaction, DEFAULT_DB_ALIAS, DatabaseError,
|
||||||
IntegrityError)
|
IntegrityError)
|
||||||
|
@ -367,11 +367,13 @@ class SavepointTest(IgnoreDeprecationWarningsMixin, TransactionTestCase):
|
||||||
|
|
||||||
@skipIf(connection.vendor == 'sqlite',
|
@skipIf(connection.vendor == 'sqlite',
|
||||||
"SQLite doesn't support savepoints in managed mode")
|
"SQLite doesn't support savepoints in managed mode")
|
||||||
@skipIf(connection.vendor == 'mysql' and
|
|
||||||
connection.features._mysql_storage_engine == 'MyISAM',
|
|
||||||
"MyISAM MySQL storage engine doesn't support savepoints")
|
|
||||||
@skipUnlessDBFeature('uses_savepoints')
|
@skipUnlessDBFeature('uses_savepoints')
|
||||||
def test_savepoint_rollback(self):
|
def test_savepoint_rollback(self):
|
||||||
|
# _mysql_storage_engine issues a query and as such can't be applied in
|
||||||
|
# a skipIf decorator since that would execute the query on module load.
|
||||||
|
if (connection.vendor == 'mysql' and
|
||||||
|
connection.features._mysql_storage_engine == 'MyISAM'):
|
||||||
|
raise SkipTest("MyISAM MySQL storage engine doesn't support savepoints")
|
||||||
@commit_manually
|
@commit_manually
|
||||||
def work():
|
def work():
|
||||||
mod = Mod.objects.create(fld=1)
|
mod = Mod.objects.create(fld=1)
|
||||||
|
|
Loading…
Reference in New Issue