Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Changed a bit the strategy used to test staticfiles finders so they c…

…an 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
  • Loading branch information...
commit d0716044ddc2c629ee459af00b2b876c5d8c0a3d 1 parent 407f62f
Ramiro Morales authored May 27, 2011
16  tests/regressiontests/staticfiles_tests/tests.py
@@ -17,7 +17,7 @@
17 17
 from django.utils._os import rmtree_errorhandler
18 18
 
19 19
 
20  
-TEST_ROOT = os.path.normcase(os.path.dirname(__file__))
  20
+TEST_ROOT = os.path.dirname(__file__)
21 21
 
22 22
 
23 23
 class StaticFilesTestCase(TestCase):
@@ -352,15 +352,23 @@ def test_serve_admin_media(self):
352 352
 
353 353
 class FinderTestCase(object):
354 354
     """
355  
-    Base finder test mixin
  355
+    Base finder test mixin.
  356
+
  357
+    On Windows, sometimes the case of the path we ask the finders for and the
  358
+    path(s) they find can differ. Compare them using os.path.normcase() to
  359
+    avoid false negatives.
356 360
     """
357 361
     def test_find_first(self):
358 362
         src, dst = self.find_first
359  
-        self.assertEqual(self.finder.find(src), dst)
  363
+        found = self.finder.find(src)
  364
+        self.assertEqual(os.path.normcase(found), os.path.normcase(dst))
360 365
 
361 366
     def test_find_all(self):
362 367
         src, dst = self.find_all
363  
-        self.assertEqual(self.finder.find(src, all=True), dst)
  368
+        found = self.finder.find(src, all=True)
  369
+        found = [os.path.normcase(f) for f in found]
  370
+        dst = [os.path.normcase(d) for d in dst]
  371
+        self.assertEqual(found, dst)
364 372
 
365 373
 
366 374
 class TestFileSystemFinder(StaticFilesTestCase, FinderTestCase):

0 notes on commit d071604

Please sign in to comment.
Something went wrong with that request. Please try again.