mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
[2.2.x] Fixed #30361 -- Increased the default timeout of watchman client to 5 seconds and made it customizable.
Made the default timeout of watchman client customizable via
DJANGO_WATCHMAN_TIMEOUT environment variable.
Backport of ed3c59097a from master
This commit is contained in:
committed by
Mariusz Felisiak
parent
a4095dadc4
commit
e45763193f
@@ -556,6 +556,11 @@ def skip_unless_watchman_available():
|
||||
class WatchmanReloaderTests(ReloaderTests, IntegrationTests):
|
||||
RELOADER_CLS = autoreload.WatchmanReloader
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
# Shorten the timeout to speed up tests.
|
||||
self.reloader.client_timeout = 0.1
|
||||
|
||||
def test_watch_glob_ignores_non_existing_directories_two_levels(self):
|
||||
with mock.patch.object(self.reloader, '_subscribe') as mocked_subscribe:
|
||||
self.reloader._watch_glob(self.tempdir / 'does_not_exist' / 'more', ['*'])
|
||||
@@ -636,6 +641,10 @@ class WatchmanReloaderTests(ReloaderTests, IntegrationTests):
|
||||
self.reloader.update_watches()
|
||||
self.assertIsInstance(mocked_server_status.call_args[0][0], TestException)
|
||||
|
||||
@mock.patch.dict(os.environ, {'DJANGO_WATCHMAN_TIMEOUT': '10'})
|
||||
def test_setting_timeout_from_environment_variable(self):
|
||||
self.assertEqual(self.RELOADER_CLS.client_timeout, 10)
|
||||
|
||||
|
||||
class StatReloaderTests(ReloaderTests, IntegrationTests):
|
||||
RELOADER_CLS = autoreload.StatReloader
|
||||
|
||||
Reference in New Issue
Block a user