@@ -140,96 +140,9 @@ def test_no_config_no_infer() -> None:
140
140
)
141
141
142
142
143
- Expectation = SimpleNamespace
144
-
145
-
146
143
class TestVersionInferenceDecision :
147
144
"""Test the version inference decision logic."""
148
145
149
- @pytest .mark .parametrize (
150
- "expectation" ,
151
- [
152
- pytest .param (
153
- Expectation (
154
- current_version = None ,
155
- overrides = OVERRIDES .UNRELATED ,
156
- expected = VersionInferenceConfig ,
157
- ),
158
- id = "missing_version_with_overrides_triggers" ,
159
- ),
160
- pytest .param (
161
- Expectation (
162
- current_version = "1.0.0" ,
163
- overrides = OVERRIDES .UNRELATED ,
164
- expected = WARNING_PACKAGE ,
165
- ),
166
- id = "overrides_on_existing_version_warns" ,
167
- ),
168
- pytest .param (
169
- Expectation (
170
- current_version = "1.0.0" ,
171
- overrides = None ,
172
- expected = WARNING_PACKAGE ,
173
- ),
174
- id = "version_already_set_no_overrides" ,
175
- ),
176
- pytest .param (
177
- Expectation (
178
- current_version = None ,
179
- overrides = OVERRIDES .EMPTY ,
180
- expected = VersionInferenceConfig ,
181
- ),
182
- id = "version_keyword_with_empty_overrides" ,
183
- ),
184
- pytest .param (
185
- Expectation (
186
- current_version = "1.0.0" ,
187
- overrides = OVERRIDES .EMPTY ,
188
- expected = WARNING_PACKAGE ,
189
- ),
190
- id = "version_keyword_empty_overrides_existing_version" ,
191
- ),
192
- pytest .param (
193
- Expectation (
194
- current_version = "1.0.0" ,
195
- overrides = None ,
196
- expected = WARNING_PACKAGE ,
197
- ),
198
- id = "version_already_set_by_something_else" ,
199
- ),
200
- pytest .param (
201
- Expectation (
202
- current_version = None ,
203
- overrides = None ,
204
- expected = VersionInferenceConfig ,
205
- ),
206
- id = "both_required_and_tool_section" ,
207
- ),
208
- ],
209
- )
210
- @pytest .mark .xfail (reason = "TODO: fix this" )
211
- def test_default_package_scenarios (self , expectation : Expectation ) -> None :
212
- """Test version inference scenarios using default package name and pyproject data."""
213
- expectation .check ()
214
-
215
- def test_no_setuptools_scm_config_infer_version (self ) -> None :
216
- """Test that we don't infer when setuptools-scm is not configured and infer_version called."""
217
- expect_config (
218
- current_version = None ,
219
- pyproject_data = PYPROJECT .WITHOUT_TOOL_SECTION ,
220
- overrides = None ,
221
- expected = NOOP ,
222
- )
223
-
224
- def test_no_setuptools_scm_config_version_keyword (self ) -> None :
225
- """We infer when setuptools-scm is not configured but use_scm_version=True."""
226
- expect_config (
227
- current_version = None ,
228
- pyproject_data = PYPROJECT .WITHOUT_TOOL_SECTION ,
229
- overrides = OVERRIDES .EMPTY ,
230
- expected = VersionInferenceConfig ,
231
- )
232
-
233
146
def test_setuptools_scm_required_no_project_section_infer_version (self ) -> None :
234
147
"""We don't infer without tool section even if required: infer_version path."""
235
148
expect_config (
@@ -259,35 +172,10 @@ def test_setuptools_scm_required_no_project_section_version_keyword_with_config(
259
172
expected = VersionInferenceConfig ,
260
173
)
261
174
262
- def test_setuptools_scm_required_with_project_section (self ) -> None :
263
- """We only infer when tool section present, regardless of required/project presence."""
264
- expect_config (
265
- current_version = None ,
266
- pyproject_data = PYPROJECT .WITHOUT_TOOL_SECTION ,
267
- expected = NOOP ,
268
- )
269
-
270
175
def test_tool_section_present (self ) -> None :
271
176
"""We infer when tool section is present."""
272
177
expect_config (
273
178
current_version = None ,
274
179
pyproject_data = PYPROJECT .WITHOUT_PROJECT ,
275
180
expected = VersionInferenceConfig ,
276
181
)
277
-
278
- def test_none_dist_name (self ) -> None :
279
- """Test that we handle None dist_name correctly."""
280
- expect_config (
281
- dist_name = None ,
282
- current_version = None ,
283
- expected = VersionInferenceConfig ,
284
- )
285
-
286
- def test_version_already_set_none_dist_name (self ) -> None :
287
- """infer_version call with None dist_name and existing version warns when inference is implied."""
288
- expect_config (
289
- dist_name = None ,
290
- current_version = "1.0.0" ,
291
- overrides = None ,
292
- expected = WARNING_NO_PACKAGE ,
293
- )
0 commit comments