@@ -39,6 +39,20 @@ def git_dir(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
3939 subprocess .run (["git" , "init" ], check = True )
4040 subprocess .
run ([
"git" ,
"config" ,
"user.email" ,
"[email protected] " ],
check = True )
4141 subprocess .run (["git" , "config" , "user.name" , "CI" ], check = True )
42+ Path (".gitignore" ).write_text (
43+ inspect .cleandoc ("""
44+ some-ignored-file.txt
45+ """ )
46+ )
47+ Path ("example" ).mkdir ()
48+ Path ("example/__init__.py" ).touch ()
49+ Path ("ignore-me.txt" ).touch ()
50+ Path ("not-ignored.txt" ).touch ()
51+ Path ("some-file" ).touch ()
52+ Path ("some-dir" ).mkdir ()
53+ Path ("some-dir/notme.txt" ).touch ()
54+ Path ("some-ignored-file.txt" ).touch ()
55+
4256 return tmp_path
4357
4458
@@ -52,7 +66,7 @@ def test_hatchling(backend: str):
5266 build-backend = "hatchling.build"
5367
5468 [project]
55- name = "hatchling-test "
69+ name = "example "
5670 version = "0.1.0"
5771
5872 [tool.hatch]
@@ -62,19 +76,8 @@ def test_hatchling(backend: str):
6276 build-backend = "{ backend } "
6377 """ )
6478 )
65- Path (".gitignore" ).write_text (
66- inspect .cleandoc ("""
67- some-ignored-file.txt
68- """ )
69- )
70- Path ("ignore-me.txt" ).touch ()
71- Path ("not-ignored.txt" ).touch ()
72- Path ("some-file" ).touch ()
73- Path ("some-dir" ).mkdir ()
74- Path ("some-dir/notme.txt" ).touch ()
7579 subprocess .run (["git" , "add" , "." ], check = True )
7680 subprocess .run (["git" , "commit" , "-m" , "Initial commit" ], check = True )
77- Path ("some-ignored-file.txt" ).touch ()
7881 assert compare (Path (), isolated = True , verbose = True ) == (
7982 0 if backend == "auto" else 2
8083 )
@@ -90,7 +93,7 @@ def test_flit_core(backend: str):
9093 build-backend = "flit_core.buildapi"
9194
9295 [project]
93- name = "flit-core-test "
96+ name = "example "
9497 version = "0.1.0"
9598 description = "A test package"
9699
@@ -102,21 +105,129 @@ def test_flit_core(backend: str):
102105 build-backend = "{ backend } "
103106 """ )
104107 )
105- Path (".gitignore" ).write_text (
108+ subprocess .run (["git" , "add" , "." ], check = True )
109+ subprocess .run (["git" , "commit" , "-m" , "Initial commit" ], check = True )
110+ assert compare (Path (), isolated = True , verbose = True ) == (
111+ 0 if backend == "auto" else 2
112+ )
113+
114+
115+ @pytest .mark .usefixtures ("git_dir" )
116+ @pytest .mark .parametrize ("backend" , ["auto" , "none" ])
117+ def test_scikit_build_core (backend : str ):
118+ Path ("pyproject.toml" ).write_text (
119+ inspect .cleandoc (f"""
120+ [build-system]
121+ requires = ["scikit-build-core"]
122+ build-backend = "scikit_build_core.build"
123+
124+ [project]
125+ name = "example"
126+ version = "0.1.0"
127+
128+ [tool.scikit-build]
129+ sdist.exclude = ["ignore*", "some-file", "**/notme.txt"]
130+
131+ [tool.check-sdist]
132+ build-backend = "{ backend } "
133+ """ )
134+ )
135+ subprocess .run (["git" , "add" , "." ], check = True )
136+ subprocess .run (["git" , "commit" , "-m" , "Initial commit" ], check = True )
137+ assert compare (Path (), isolated = True , verbose = True ) == (
138+ 0 if backend == "auto" else 2
139+ )
140+
141+
142+ @pytest .mark .usefixtures ("git_dir" )
143+ @pytest .mark .parametrize ("backend" , ["auto" , "none" ])
144+ def test_pdm_backend (backend : str ):
145+ Path ("pyproject.toml" ).write_text (
146+ inspect .cleandoc (f"""
147+ [build-system]
148+ requires = ["pdm-backend"]
149+ build-backend = "pdm.backend"
150+
151+ [project]
152+ name = "example"
153+ version = "0.1.0"
154+
155+ [tool.pdm]
156+ build.source-includes = [".gitignore", "not-ignored.txt"]
157+ build.excludes = ["ignore*", "some-file", "**/notme.txt"]
158+
159+ [tool.check-sdist]
160+ build-backend = "{ backend } "
161+ """ )
162+ )
163+ subprocess .run (["git" , "add" , "." ], check = True )
164+ subprocess .run (["git" , "commit" , "-m" , "Initial commit" ], check = True )
165+ assert compare (Path (), isolated = True , verbose = True ) == (
166+ 0 if backend == "auto" else 2
167+ )
168+
169+
170+ @pytest .mark .skip
171+ @pytest .mark .usefixtures ("git_dir" )
172+ @pytest .mark .parametrize ("backend" , ["auto" , "none" ])
173+ def test_maturin (backend : str ):
174+ Path ("pyproject.toml" ).write_text (
175+ inspect .cleandoc (f"""
176+ [build-system]
177+ requires = ["maturin"]
178+ build-backend = "maturin"
179+
180+ [project]
181+ name = "example"
182+ version = "0.1.0"
183+
184+ [tool.maturin]
185+ exclude = ["ignore*", "some-file", "**/notme.txt"]
186+
187+ [tool.check-sdist]
188+ build-backend = "{ backend } "
189+ """ )
190+ )
191+ Path ("Cargo.toml" ).write_text (
106192 inspect .cleandoc ("""
107- some-ignored-file.txt
108- """ )
193+ [package]
194+ name = "guessing-game"
195+ version = "0.1.0"
196+ edition = "2021"
197+ """ )
198+ )
199+ Path ("src" ).mkdir ()
200+ Path ("src/lib.rs" ).write_text ("" )
201+ subprocess .run (["git" , "add" , "." ], check = True )
202+ subprocess .run (["git" , "commit" , "-m" , "Initial commit" ], check = True )
203+ assert compare (Path (), isolated = True , verbose = True ) == (
204+ 0 if backend == "auto" else 2
205+ )
206+
207+
208+ @pytest .mark .usefixtures ("git_dir" )
209+ @pytest .mark .parametrize ("backend" , ["auto" , "none" ])
210+ def test_poetry_core (backend : str ):
211+ Path ("pyproject.toml" ).write_text (
212+ inspect .cleandoc (f"""
213+ [build-system]
214+ requires = ["poetry-core"]
215+ build-backend = "poetry.core.masonry.api"
216+
217+ [tool.poetry]
218+ name = "example"
219+ version = "0.1.0"
220+ authors = []
221+ description = "A test package."
222+ include = [".gitignore", "not-ignored.txt"]
223+ exclude = ["ignore*", {{path="some-file", format=["sdist"]}}, "**/notme.txt"]
224+
225+ [tool.check-sdist]
226+ build-backend = "{ backend } "
227+ """ )
109228 )
110- Path ("ignore-me.txt" ).touch ()
111- Path ("not-ignored.txt" ).touch ()
112- Path ("some-file" ).touch ()
113- Path ("some-dir" ).mkdir ()
114- Path ("some-dir/notme.txt" ).touch ()
115- Path ("flit_core_test" ).mkdir ()
116- Path ("flit_core_test/__init__.py" ).touch ()
117229 subprocess .run (["git" , "add" , "." ], check = True )
118230 subprocess .run (["git" , "commit" , "-m" , "Initial commit" ], check = True )
119- Path ("some-ignored-file.txt" ).touch ()
120231 assert compare (Path (), isolated = True , verbose = True ) == (
121232 0 if backend == "auto" else 2
122233 )
0 commit comments