summaryrefslogtreecommitdiff
path: root/tests/utils_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils_tests')
-rw-r--r--tests/utils_tests/test_autoreload.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py
index 82f7287fa8..56b03d40a6 100644
--- a/tests/utils_tests/test_autoreload.py
+++ b/tests/utils_tests/test_autoreload.py
@@ -656,6 +656,16 @@ class StatReloaderTests(ReloaderTests, IntegrationTests):
# Shorten the sleep time to speed up tests.
self.reloader.SLEEP_TIME = 0.01
+ @mock.patch('django.utils.autoreload.StatReloader.notify_file_changed')
+ def test_tick_does_not_trigger_twice(self, mock_notify_file_changed):
+ with mock.patch.object(self.reloader, 'watched_files', return_value=[self.existing_file]):
+ ticker = self.reloader.tick()
+ next(ticker)
+ self.increment_mtime(self.existing_file)
+ next(ticker)
+ next(ticker)
+ self.assertEqual(mock_notify_file_changed.call_count, 1)
+
def test_snapshot_files_ignores_missing_files(self):
with mock.patch.object(self.reloader, 'watched_files', return_value=[self.nonexistent_file]):
self.assertEqual(dict(self.reloader.snapshot_files()), {})