From ae727e72416c675b98e00faadbb64cb296cc274c Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Mon, 28 Oct 2024 21:28:11 +0000 Subject: [PATCH] 100% test coverage (#125) --- tests/test_django_watchfiles.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/test_django_watchfiles.py b/tests/test_django_watchfiles.py index 2d50668..c2b7e57 100644 --- a/tests/test_django_watchfiles.py +++ b/tests/test_django_watchfiles.py @@ -122,6 +122,27 @@ def test_file_filter_glob_matched(self): assert result is True + def test_file_filter_glob_multiple_globs_unmatched(self): + self.reloader.watch_dir(self.temp_path, "*.css") + self.reloader.watch_dir(self.temp_path, "*.html") + + result = self.reloader.file_filter( + Change.modified, str(self.temp_path / "test.py") + ) + + assert result is False + + def test_file_filter_glob_multiple_dirs_unmatched(self): + self.reloader.watch_dir(self.temp_path, "*.css") + temp_dir2 = self.enterContext(tempfile.TemporaryDirectory()) + self.reloader.watch_dir(Path(temp_dir2), "*.html") + + result = self.reloader.file_filter( + Change.modified, str(self.temp_path / "test.py") + ) + + assert result is False + def test_file_filter_glob_relative_path_impossible(self): temp_dir2 = self.enterContext(tempfile.TemporaryDirectory()) @@ -133,6 +154,13 @@ def test_file_filter_glob_relative_path_impossible(self): assert result is False + def test_tick(self): + test_txt = self.temp_path / "test.txt" + test_txt.touch() + self.reloader.watched_files_set = {test_txt} + + self.reloader.tick() + class ReplacedGetReloaderTests(SimpleTestCase): def test_replaced_get_reloader(self):