@@ -619,6 +619,46 @@ def test_watches_through_relative_symlinks(self, origin_dir, site_dir):
619619 Path (origin_dir , "README.md" ).write_text ("edited" )
620620 self .assertTrue (started_building .wait (timeout = 10 ))
621621
622+ @tempdir ({"foo.md" : "original" })
623+ def test_ignores_dotfile_changes (self , docs_dir ):
624+ """Hidden files (starting with '.') should not trigger rebuild."""
625+ started_building = threading .Event ()
626+ with testing_server (docs_dir , started_building .set ) as server :
627+ server .watch (docs_dir )
628+ time .sleep (0.01 )
629+
630+ # Vim swap file
631+ Path (docs_dir , ".foo.md.swp" ).write_text ("swap" )
632+ self .assertFalse (started_building .wait (timeout = 0.5 ))
633+
634+ # Generic dotfile
635+ Path (docs_dir , ".hidden" ).write_text ("hidden" )
636+ self .assertFalse (started_building .wait (timeout = 0.5 ))
637+
638+ @tempdir ({"foo.md" : "original" })
639+ def test_ignores_tilde_backup_files (self , docs_dir ):
640+ """Editor backup files (ending with '~') should not trigger rebuild."""
641+ started_building = threading .Event ()
642+ with testing_server (docs_dir , started_building .set ) as server :
643+ server .watch (docs_dir )
644+ time .sleep (0.01 )
645+
646+ # Backup file created by editors
647+ Path (docs_dir , "foo.md~" ).write_text ("backup" )
648+ self .assertFalse (started_building .wait (timeout = 0.5 ))
649+
650+ @tempdir ({"foo.md" : "original" })
651+ def test_ignores_emacs_autosave_files (self , docs_dir ):
652+ """Emacs auto-save files (#*#) should not trigger rebuild."""
653+ started_building = threading .Event ()
654+ with testing_server (docs_dir , started_building .set ) as server :
655+ server .watch (docs_dir )
656+ time .sleep (0.01 )
657+
658+ # Emacs auto-save pattern
659+ Path (docs_dir , "#foo.md#" ).write_text ("autosave" )
660+ self .assertFalse (started_building .wait (timeout = 0.5 ))
661+
622662 @tempdir ()
623663 def test_watch_with_broken_symlinks (self , docs_dir ):
624664 Path (docs_dir , "subdir" ).mkdir ()
0 commit comments