diff options
| author | Carlton Gibson <carlton.gibson@noumenal.es> | 2022-07-05 10:46:10 +0200 |
|---|---|---|
| committer | Carlton Gibson <carlton@noumenal.es> | 2022-08-11 11:02:03 +0200 |
| commit | e34dfad0a310c616c7b62e0f1dba10f10adf547a (patch) | |
| tree | ff03240f9494f75bd98f584a31da69e807afdd1d | |
| parent | 35911078fa40eb35859832987fedada76963c01e (diff) | |
Refs #30213 -- Removed post-startup check for Watchman availability.
This is checked at startup in get_reloader(). The runtime check ties
the implementation to Watchman excessively.
| -rw-r--r-- | django/utils/autoreload.py | 11 | ||||
| -rw-r--r-- | tests/utils_tests/test_autoreload.py | 10 |
2 files changed, 1 insertions, 20 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py index f4076d6d31..5b22aef2b1 100644 --- a/django/utils/autoreload.py +++ b/django/utils/autoreload.py @@ -657,16 +657,7 @@ def start_django(reloader, main_func, *args, **kwargs): django_main_thread.start() while not reloader.should_stop: - try: - reloader.run(django_main_thread) - except WatchmanUnavailable as ex: - # It's possible that the watchman service shuts down or otherwise - # becomes unavailable. In that case, use the StatReloader. - reloader = StatReloader() - logger.error("Error connecting to Watchman: %s", ex) - logger.info( - "Watching for file changes with %s", reloader.__class__.__name__ - ) + reloader.run(django_main_thread) def run_with_reloader(main_func, *args, **kwargs): diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py index 6fe7ae64fa..b6286925b7 100644 --- a/tests/utils_tests/test_autoreload.py +++ b/tests/utils_tests/test_autoreload.py @@ -381,16 +381,6 @@ class RunWithReloaderTests(SimpleTestCase): class StartDjangoTests(SimpleTestCase): - @mock.patch("django.utils.autoreload.StatReloader") - def test_watchman_becomes_unavailable(self, mocked_stat): - mocked_stat.should_stop.return_value = True - fake_reloader = mock.MagicMock() - fake_reloader.should_stop = False - fake_reloader.run.side_effect = autoreload.WatchmanUnavailable() - - autoreload.start_django(fake_reloader, lambda: None) - self.assertEqual(mocked_stat.call_count, 1) - @mock.patch("django.utils.autoreload.ensure_echo_on") def test_echo_on_called(self, mocked_echo): fake_reloader = mock.MagicMock() |
