summaryrefslogtreecommitdiff
path: root/tests/staticfiles_tests
diff options
context:
space:
mode:
authorHuu Nguyen <huu@prismskylabs.com>2014-04-07 16:06:03 -0700
committerTim Graham <timograham@gmail.com>2014-05-18 14:27:35 -0400
commit949ee521fab106b44218c30577eb55f0097d39cd (patch)
treef2e60c181183232386335fc1f577dadbc5e3c588 /tests/staticfiles_tests
parente3a9714ce3aa7433480672902a59e9ea803dc9de (diff)
Refs #21230 -- removed direct settings manipulation from staticfile tests
Diffstat (limited to 'tests/staticfiles_tests')
-rw-r--r--tests/staticfiles_tests/project/site_media/static/testfile.txt1
-rw-r--r--tests/staticfiles_tests/tests.py14
2 files changed, 3 insertions, 12 deletions
diff --git a/tests/staticfiles_tests/project/site_media/static/testfile.txt b/tests/staticfiles_tests/project/site_media/static/testfile.txt
deleted file mode 100644
index 4d92dbe1ad..0000000000
--- a/tests/staticfiles_tests/project/site_media/static/testfile.txt
+++ /dev/null
@@ -1 +0,0 @@
-Test! \ No newline at end of file
diff --git a/tests/staticfiles_tests/tests.py b/tests/staticfiles_tests/tests.py
index e5c24db6bf..f1fd94f162 100644
--- a/tests/staticfiles_tests/tests.py
+++ b/tests/staticfiles_tests/tests.py
@@ -6,7 +6,6 @@ import os
import posixpath
import shutil
import sys
-import tempfile
import unittest
from django.template import loader, Context
@@ -121,17 +120,13 @@ class BaseCollectionTestCase(BaseStaticFilesTestCase):
"""
def setUp(self):
super(BaseCollectionTestCase, self).setUp()
- self.old_root = settings.STATIC_ROOT
- settings.STATIC_ROOT = tempfile.mkdtemp(dir=os.environ['DJANGO_TEST_TEMP_DIR'])
+ if not os.path.exists(settings.STATIC_ROOT):
+ os.mkdir(settings.STATIC_ROOT)
self.run_collectstatic()
# Use our own error handler that can handle .svn dirs on Windows
self.addCleanup(shutil.rmtree, settings.STATIC_ROOT,
ignore_errors=True, onerror=rmtree_errorhandler)
- def tearDown(self):
- settings.STATIC_ROOT = self.old_root
- super(BaseCollectionTestCase, self).tearDown()
-
def run_collectstatic(self, **kwargs):
call_command('collectstatic', interactive=False, verbosity='0',
ignore_patterns=['*.ignoreme'], **kwargs)
@@ -754,14 +749,11 @@ class TestServeStatic(StaticFilesTestCase):
self.assertEqual(self._response(filepath).status_code, 404)
+@override_settings(DEBUG=False)
class TestServeDisabled(TestServeStatic):
"""
Test serving static files disabled when DEBUG is False.
"""
- def setUp(self):
- super(TestServeDisabled, self).setUp()
- settings.DEBUG = False
-
def test_disabled_serving(self):
self.assertFileNotFound('test.txt')