diff options
| author | Tim Graham <timograham@gmail.com> | 2014-07-25 09:32:14 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-07-25 13:23:52 -0400 |
| commit | b8cb5ba7081388ef38eccdf8e826747ad3a67e66 (patch) | |
| tree | 1df4391fc04bd30f47efaccdbfd0bca7872110d4 /tests | |
| parent | 08681d7757152d805533296d69ad9b8e2c129b1c (diff) | |
Fixed #23083 -- Fixed runserver reloading when deleting a file.
Thanks Collin Anderson for the report and hirokiky for the fix.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/utils_tests/test_autoreload.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py index e7ef8537c0..1edf3f9bf8 100644 --- a/tests/utils_tests/test_autoreload.py +++ b/tests/utils_tests/test_autoreload.py @@ -1,9 +1,12 @@ +from importlib import import_module import os +import tempfile from django import conf from django.contrib import admin from django.test import TestCase, override_settings from django.utils.autoreload import gen_filenames +from django.utils._os import upath LOCALE_PATH = os.path.join(os.path.dirname(__file__), 'locale') @@ -82,3 +85,13 @@ class TestFilenameGenerator(TestCase): self.assertEqual(len(filenames2), 1) self.assertTrue(filenames2[0].endswith('fractions.py')) self.assertFalse(any(f.endswith('.pyc') for f in gen_filenames())) + + def test_deleted_removed(self): + _, filepath = tempfile.mkstemp(dir=os.path.dirname(upath(__file__)), suffix='.py') + try: + _, filename = os.path.split(filepath) + import_module('.%s' % filename.rstrip('.py'), package='utils_tests') + self.assertIn(filepath, gen_filenames()) + finally: + os.remove(filepath) + self.assertNotIn(filepath, gen_filenames()) |
