mirror of
https://github.com/django/django.git
synced 2025-08-31 15:57:45 +00:00
Fixed #21281 -- Made override_settings act at class level when used as a TestCase decorator.
This commit is contained in:
parent
8b77b64f1c
commit
d89f56dc4d
9 changed files with 73 additions and 27 deletions
|
@ -33,12 +33,14 @@ class FileUploadTests(TestCase):
|
|||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(FileUploadTests, cls).setUpClass()
|
||||
if not os.path.isdir(MEDIA_ROOT):
|
||||
os.makedirs(MEDIA_ROOT)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
shutil.rmtree(MEDIA_ROOT)
|
||||
super(FileUploadTests, cls).tearDownClass()
|
||||
|
||||
def test_simple_upload(self):
|
||||
with open(__file__, 'rb') as fp:
|
||||
|
@ -494,12 +496,14 @@ class DirectoryCreationTests(TestCase):
|
|||
"""
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(DirectoryCreationTests, cls).setUpClass()
|
||||
if not os.path.isdir(MEDIA_ROOT):
|
||||
os.makedirs(MEDIA_ROOT)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
shutil.rmtree(MEDIA_ROOT)
|
||||
super(DirectoryCreationTests, cls).tearDownClass()
|
||||
|
||||
def setUp(self):
|
||||
self.obj = FileModel()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue