mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
Fixed #16224 -- Fixed override_settings test utility to correctly work with TestCase classes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16377 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1,11 +1,22 @@
|
||||
from __future__ import with_statement
|
||||
import os, sys
|
||||
import os
|
||||
from django.conf import settings, global_settings
|
||||
from django.test import TestCase, signals
|
||||
from django.test.utils import override_settings
|
||||
from django.utils.unittest import skipIf
|
||||
|
||||
|
||||
# @override_settings(TEST='override')
|
||||
class FullyDecoratedTestCase(TestCase):
|
||||
|
||||
def test_override(self):
|
||||
self.assertEqual(settings.TEST, 'override')
|
||||
|
||||
@override_settings(TEST='override2')
|
||||
def test_method_override(self):
|
||||
self.assertEqual(settings.TEST, 'override2')
|
||||
|
||||
FullyDecoratedTestCase = override_settings(TEST='override')(FullyDecoratedTestCase)
|
||||
|
||||
class SettingGetter(object):
|
||||
def __init__(self):
|
||||
self.test = getattr(settings, 'TEST', 'undefined')
|
||||
|
||||
Reference in New Issue
Block a user