summaryrefslogtreecommitdiff
path: root/tests/utils_tests
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 13:35:47 +0200
commite45763193fe496cefc6749c45e6a31e62f987d63 (patch)
tree14f54f837c9a4667f6d1b1085693cf0ca607c875 /tests/utils_tests
parenta4095dadc4b165f615dfc88c6ed1cbba5b5a9844 (diff)
[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 ed3c59097a01ed3f32f8a8bed95307fb5c181251 from master
Diffstat (limited to 'tests/utils_tests')
-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 1f3bc0c95b..f47ad46b8b 100644
--- a/tests/utils_tests/test_autoreload.py
+++ b/tests/utils_tests/test_autoreload.py
@@ -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