Skip to content

Commit 86ac199

Browse files
authored
✅ Add test to make sure .fastapicloudignore can override .gitignore (#90) (#95)
1 parent dbbb543 commit 86ac199

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/test_archive.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff 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"}

0 commit comments

Comments
 (0)