File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -79,3 +79,25 @@ def test_archive_respects_fastapicloudignore(tmp_path: Path) -> None:
7979 "main.py" ,
8080 "config.py" ,
8181 }
82+
83+
84+ def test_archive_respects_fastapicloudignore_unignore (tmp_path : Path ) -> None :
85+ """Test we can use .fastapicloudignore to unignore files inside .gitignore"""
86+ # Create test files
87+ (tmp_path / "main.py" ).write_text ("print('hello')" )
88+ (tmp_path / "static/build" ).mkdir (exist_ok = True , parents = True )
89+ (tmp_path / "static/build/style.css" ).write_text ("body { background: #bada55 }" )
90+ # Rignore needs a .git folder to make .gitignore work
91+ (tmp_path / ".git" ).mkdir (exist_ok = True , parents = True )
92+ (tmp_path / ".gitignore" ).write_text ("build/" )
93+
94+ # Create .fastapicloudignore file
95+ (tmp_path / ".fastapicloudignore" ).write_text ("!static/build" )
96+
97+ # Create archive
98+ tar_path = archive (tmp_path )
99+
100+ # Verify ignored files are excluded
101+ with tarfile .open (tar_path , "r" ) as tar :
102+ names = tar .getnames ()
103+ assert set (names ) == {"main.py" , "static/build/style.css" }
You can’t perform that action at this time.
0 commit comments