#17462: TestCollectionCachedStorage errors & failure on Windows
-----------------------------------------------+--------------------------
               Reporter:  kmtracey             |          Owner:  kmtracey
                   Type:  Bug                  |         Status:  new
              Component:  contrib.staticfiles  |        Version:  SVN
               Severity:  Release blocker      |       Keywords:
           Triage Stage:  Unreviewed           |      Has patch:  0
    Needs documentation:  0                    |    Needs tests:  0
Patch needs improvement:  0                    |  Easy pickings:  0
                  UI/UX:  0                    |
-----------------------------------------------+--------------------------
 I'm getting 10 errors running the staticfiles_tests on Windows. They're
 all related to the new !CachedStaticFilesStorage backend, and in fact all
 the same error (collectstatic called by setUp is failing), here's one
 example:

 {{{
 ======================================================================
 ERROR: test_cache_invalidation
 (regressiontests.staticfiles_tests.tests.TestCollectionCachedStorage)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 
"C:\Users\kmtracey\django\trunk\tests\regressiontests\staticfiles_tests\tests.py",
 line 104, in setUp
     self.run_collectstatic()
   File
 
"C:\Users\kmtracey\django\trunk\tests\regressiontests\staticfiles_tests\tests.py",
 line 115, in run_collectstatic
     ignore_patterns=['*.ignoreme'], **kwargs)
   File
 "C:\Users\kmtracey\django\trunk\django\core\management\__init__.py", line
 146, in call_command
     return klass.execute(*args, **defaults)
   File "C:\Users\kmtracey\django\trunk\django\core\management\base.py",
 line 232, in execute
     output = self.handle(*args, **options)
   File "C:\Users\kmtracey\django\trunk\django\core\management\base.py",
 line 371, in handle
     return self.handle_noargs(**options)
   File
 
"C:\Users\kmtracey\django\trunk\django\contrib\staticfiles\management\commands\collectstatic.py",
 line 131, in handle_noargs
     post_processed = self.storage.post_process(found_files, **options)
   File
 "C:\Users\kmtracey\django\trunk\django\contrib\staticfiles\storage.py",
 line 179, in post_process
     content = pattern.sub(converter, content)
   File
 "C:\Users\kmtracey\django\trunk\django\contrib\staticfiles\storage.py",
 line 142, in converter
     hashed_url = self.url(unquote(joined_result), force=True)
   File
 "C:\Users\kmtracey\django\trunk\django\contrib\staticfiles\storage.py",
 line 105, in url
     hashed_name = self.hashed_name(name)
   File
 "C:\Users\kmtracey\django\trunk\django\contrib\staticfiles\storage.py",
 line 74, in hashed_name
     (clean_name, self))
 ValueError: The file 'img/window.png' could not be found with
 django.contrib.staticfiles.storage.CachedStaticFilesStorage object at
 0x00000000039F83C8>.
 }}}

 This error can be fixed by splitting the file name passed to url_converter
 converter on `os.sep` instead of '/'.

 However there is then still a failure:

 {{{
 test_cache_invalidation
 (regressiontests.staticfiles_tests.tests.TestCollectionCachedStorage) ...
 FAIL
 test_path_with_fragment
 (regressiontests.staticfiles_tests.tests.TestCollectionCachedStorage) ...
 ok
 test_path_with_querystring
 (regressiontests.staticfiles_tests.tests.TestCollectionCachedStorage) ...
 ok
 test_template_tag_absolute
 (regressiontests.staticfiles_tests.tests.TestCollectionCachedStorage) ...
 ok
 test_template_tag_deep_relative
 (regressiontests.staticfiles_tests.tests.TestCollectionCachedStorage) ...
 ok
 test_template_tag_denorm
 (regressiontests.staticfiles_tests.tests.TestCollectionCachedStorage) ...
 ok
 test_template_tag_relative
 (regressiontests.staticfiles_tests.tests.TestCollectionCachedStorage) ...
 ok
 test_template_tag_return
 (regressiontests.staticfiles_tests.tests.TestCollectionCachedStorage) ...
 ok
 test_template_tag_simple_content
 (regressiontests.staticfiles_tests.tests.TestCollectionCachedStorage) ...
 ok
 test_template_tag_url
 (regressiontests.staticfiles_tests.tests.TestCollectionCachedStorage) ...
 ok

 ======================================================================
 FAIL: test_cache_invalidation
 (regressiontests.staticfiles_tests.tests.TestCollectionCachedStorage)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 
"C:\Users\kmtracey\django\trunk\tests\regressiontests\staticfiles_tests\tests.py",
 line 382, in test_cache_invali
 dation
     self.assertEqual(self.cached_file_path(name), cached_name)
 AssertionError: u'cached/styles.93b1147e8552.css' !=
 u'cached\\styles.93b1147e8552.css'
 - cached/styles.93b1147e8552.css
 ?       ^
 + cached\styles.93b1147e8552.css
 ?       ^


 ----------------------------------------------------------------------
 Ran 10 tests in 4.152s

 FAILED (failures=1)
 Destroying test database for alias 'default' (':memory:')...
 Destroying test database for alias 'other' (':memory:')...
 }}}

 This one is fixed by replacing backslashes with slashes in the hashed_name
 passed to `cache.set` in the url method of !CachedFilesMixin. (This is
 consistent with what is done in the post_process method.)

 I'm going to check these fixes in but am opening this ticket as well so as
 to have a record of why they were made, and to have something to re-open
 if the fixes turn out not to be quite right. Setting as a release blocker
 since it seems the new function doesn't yet work properly on Windows.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17462>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to