diff options
| author | Claude Paroz <claude@2xlibre.net> | 2014-07-05 14:43:12 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2014-07-06 21:45:09 +0200 |
| commit | 1bb8ccdb9e70bee35759f2ada4d661481852ab95 (patch) | |
| tree | 44f781f9877da4065d982c47c9d2a1232844706b /tests | |
| parent | a1ddfe440151c81898b94df4d5ea99696398c3f7 (diff) | |
[1.7.x] Fixed pyinotify performance regression in 15f82c7011
Refs #9722. Thanks Tim Graham for the review.
Backport of 6d302f639 from master.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/utils_tests/test_autoreload.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py index 1024b02efe..463cc1bcd0 100644 --- a/tests/utils_tests/test_autoreload.py +++ b/tests/utils_tests/test_autoreload.py @@ -9,6 +9,12 @@ LOCALE_PATH = os.path.join(os.path.dirname(__file__), 'locale') class TestFilenameGenerator(TestCase): + def setUp(self): + # Empty cached variables + from django.utils import autoreload + autoreload._cached_modules = set() + autoreload._cached_filenames = [] + def test_django_locales(self): """ Test that gen_filenames() also yields the built-in django locale files. @@ -64,3 +70,14 @@ class TestFilenameGenerator(TestCase): os.path.join(os.path.dirname(conf.__file__), 'locale', 'nl', 'LC_MESSAGES', 'django.mo'), filenames) + + def test_only_new_files(self): + """ + When calling a second time gen_filenames with only_new = True, only + files from newly loaded modules should be given. + """ + filenames1 = list(gen_filenames()) + from fractions import Fraction + filenames2 = list(gen_filenames(only_new=True)) + self.assertEqual(len(filenames2), 1) + self.assertTrue(filenames2[0].endswith('fractions.py')) |
