summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2011-05-27 10:55:07 +0000
committerRamiro Morales <cramm0@gmail.com>2011-05-27 10:55:07 +0000
commitd0716044ddc2c629ee459af00b2b876c5d8c0a3d (patch)
tree4ebbb15769fe486eadd7f564171e208d7ab6d631
parent407f62fd31689b6158902d3ffdcde64aa27679a7 (diff)
Changed a bit the strategy used to test staticfiles finders so they can cope with even more differences in case of paths under Windows. Refs #14961
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16285 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--tests/regressiontests/staticfiles_tests/tests.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/regressiontests/staticfiles_tests/tests.py b/tests/regressiontests/staticfiles_tests/tests.py
index b8a7aa6d33..8ecae8b92c 100644
--- a/tests/regressiontests/staticfiles_tests/tests.py
+++ b/tests/regressiontests/staticfiles_tests/tests.py
@@ -17,7 +17,7 @@ from django.utils.encoding import smart_unicode
from django.utils._os import rmtree_errorhandler
-TEST_ROOT = os.path.normcase(os.path.dirname(__file__))
+TEST_ROOT = os.path.dirname(__file__)
class StaticFilesTestCase(TestCase):
@@ -352,15 +352,23 @@ class TestServeAdminMedia(TestServeStatic):
class FinderTestCase(object):
"""
- Base finder test mixin
+ Base finder test mixin.
+
+ On Windows, sometimes the case of the path we ask the finders for and the
+ path(s) they find can differ. Compare them using os.path.normcase() to
+ avoid false negatives.
"""
def test_find_first(self):
src, dst = self.find_first
- self.assertEqual(self.finder.find(src), dst)
+ found = self.finder.find(src)
+ self.assertEqual(os.path.normcase(found), os.path.normcase(dst))
def test_find_all(self):
src, dst = self.find_all
- self.assertEqual(self.finder.find(src, all=True), dst)
+ found = self.finder.find(src, all=True)
+ found = [os.path.normcase(f) for f in found]
+ dst = [os.path.normcase(d) for d in dst]
+ self.assertEqual(found, dst)
class TestFileSystemFinder(StaticFilesTestCase, FinderTestCase):