Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

100% test coverage #125

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions tests/test_django_watchfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand All @@ -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):
Expand Down
Loading