1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

[soc2010/test-refactor] Added skipIfDBEngine() decorator to django.test

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2010/test-refactor@13416 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Paul McMillan 2010-07-02 19:06:53 +00:00
parent 9d69c8f01d
commit e0bd235ffa
2 changed files with 14 additions and 0 deletions

View File

@ -4,3 +4,4 @@ Django Unit Test and Doctest framework.
from django.test.client import Client
from django.test.testcases import TestCase, TransactionTestCase
from django.test.utils import skipIfDBEngine

View File

@ -2,9 +2,11 @@ import sys, time, os
from django.conf import settings
from django.core import mail
from django.core.mail.backends import locmem
from django.db import DEFAULT_DB_ALIAS
from django.test import signals
from django.template import Template
from django.utils.translation import deactivate
from django.utils.unittest import skipIf
class ContextList(list):
"""A wrapper that provides direct key access to context items contained
@ -77,3 +79,14 @@ def get_runner(settings):
test_module = __import__(test_module_name, {}, {}, test_path[-1])
test_runner = getattr(test_module, test_path[-1])
return test_runner
def skipIfDBEngine(engine, reason=None):
"""
Decorator to skip tests on a given database engine.
Note that you can pass a single engine or an iterable here
"""
if not reason:
reason = "not supported on this database"
return skipIf(settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'] in engine,
reason)