summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2019-07-24 13:32:02 +0200
committerGitHub <noreply@github.com>2019-07-24 13:32:02 +0200
commitfed5e19369f456e41f0768f4fb92602af027a46d (patch)
tree09ded05515784f62dc582a6353de0c417773db52
parentd89053585e11e869efcc9debb1c311b47b5e20ea (diff)
Removed unused BaseReloader.watch_file().
Unused since its introduction in c8720e7696ca41f3262d5369365cc1bd72a216ca.
-rw-r--r--django/utils/autoreload.py7
-rw-r--r--tests/utils_tests/test_autoreload.py18
2 files changed, 0 insertions, 25 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
index bf3b14609a..fc330eb87e 100644
--- a/django/utils/autoreload.py
+++ b/django/utils/autoreload.py
@@ -245,13 +245,6 @@ class BaseReloader:
logger.debug('Watching dir %s with glob %s.', path, glob)
self.directory_globs[path].add(glob)
- def watch_file(self, path):
- path = Path(path)
- if not path.is_absolute():
- raise ValueError('%s must be absolute.' % path)
- logger.debug('Watching file %s.', path)
- self.extra_files.add(path)
-
def watched_files(self, include_globs=True):
"""
Yield all files that need to be watched, including module files and
diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py
index 628749db01..5de276f035 100644
--- a/tests/utils_tests/test_autoreload.py
+++ b/tests/utils_tests/test_autoreload.py
@@ -418,15 +418,6 @@ class ReloaderTests(SimpleTestCase):
class IntegrationTests:
@mock.patch('django.utils.autoreload.BaseReloader.notify_file_changed')
@mock.patch('django.utils.autoreload.iter_all_python_module_files', return_value=frozenset())
- def test_file(self, mocked_modules, notify_mock):
- self.reloader.watch_file(self.existing_file)
- with self.tick_twice():
- self.increment_mtime(self.existing_file)
- self.assertEqual(notify_mock.call_count, 1)
- self.assertCountEqual(notify_mock.call_args[0], [self.existing_file])
-
- @mock.patch('django.utils.autoreload.BaseReloader.notify_file_changed')
- @mock.patch('django.utils.autoreload.iter_all_python_module_files', return_value=frozenset())
def test_glob(self, mocked_modules, notify_mock):
non_py_file = self.ensure_file(self.tempdir / 'non_py_file')
self.reloader.watch_dir(self.tempdir, '*.py')
@@ -508,15 +499,6 @@ class IntegrationTests:
class BaseReloaderTests(ReloaderTests):
RELOADER_CLS = autoreload.BaseReloader
- def test_watch_without_absolute(self):
- with self.assertRaisesMessage(ValueError, 'test.py must be absolute.'):
- self.reloader.watch_file('test.py')
-
- def test_watch_with_single_file(self):
- self.reloader.watch_file(self.existing_file)
- watched_files = list(self.reloader.watched_files())
- self.assertIn(self.existing_file, watched_files)
-
def test_watch_with_glob(self):
self.reloader.watch_dir(self.tempdir, '*.py')
watched_files = list(self.reloader.watched_files())