summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_autoreload.py
diff options
context:
space:
mode:
authorJacob Green <jacob@workflowy.com>2019-04-23 09:08:05 -0700
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-04-26 12:55:49 +0200
commited3c59097a01ed3f32f8a8bed95307fb5c181251 (patch)
treec972573ddf63b5779837c357d51412ced8a7c974 /tests/utils_tests/test_autoreload.py
parentefeceba589974b95b35b2e25df86498c96315518 (diff)
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.
Diffstat (limited to 'tests/utils_tests/test_autoreload.py')
-rw-r--r--tests/utils_tests/test_autoreload.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py
index fdfb47797e..c59cb23cc3 100644
--- a/tests/utils_tests/test_autoreload.py
+++ b/tests/utils_tests/test_autoreload.py
@@ -558,6 +558,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', ['*'])
@@ -638,6 +643,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)
+
@skipIf(on_macos_with_hfs(), "These tests do not work with HFS+ as a filesystem")
class StatReloaderTests(ReloaderTests, IntegrationTests):