diff options
Diffstat (limited to 'tests/staticfiles_tests')
| -rw-r--r-- | tests/staticfiles_tests/tests.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/staticfiles_tests/tests.py b/tests/staticfiles_tests/tests.py index 463ab47030..39ce49817c 100644 --- a/tests/staticfiles_tests/tests.py +++ b/tests/staticfiles_tests/tests.py @@ -55,7 +55,7 @@ class BaseStaticFilesTestCase(object): storage.staticfiles_storage._wrapped = empty # Clear the cached staticfile finders, so they are reinitialized every # run and pick up changes in settings.STATICFILES_DIRS. - finders._finders.clear() + finders.get_finder.cache_clear() testfiles_path = os.path.join(TEST_ROOT, 'apps', 'test', 'static', 'test') # To make sure SVN doesn't hangs itself with the non-ASCII characters @@ -561,7 +561,7 @@ class TestCollectionCachedStorage(BaseCollectionTestCase, Test that post_processing indicates the origin of the error when it fails. Regression test for #18986. """ - finders._finders.clear() + finders.get_finder.cache_clear() err = six.StringIO() with self.assertRaises(Exception): call_command('collectstatic', interactive=False, verbosity=0, stderr=err) @@ -756,6 +756,15 @@ class TestMiscFinder(TestCase): self.assertRaises(ImproperlyConfigured, finders.get_finder, 'foo.bar.FooBarFinder') + def test_cache(self): + finders.get_finder.cache_clear() + for n in range(10): + finders.get_finder( + 'django.contrib.staticfiles.finders.FileSystemFinder') + cache_info = finders.get_finder.cache_info() + self.assertEqual(cache_info.hits, 9) + self.assertEqual(cache_info.currsize, 1) + @override_settings(STATICFILES_DIRS='a string') def test_non_tuple_raises_exception(self): """ |
