@@ -219,8 +219,7 @@ def test_pretend_metadata_with_version(
219
219
220
220
# Test version file template functionality
221
221
wd .write ("setup.py" , SETUP_PY_PLAIN )
222
- wd ("mkdir -p src" ) # Create the src directory
223
- # This is a template string, not an f-string - used by setuptools-scm templating
222
+ wd ("mkdir -p src" )
224
223
version_file_content = """
225
224
version = '{version}'
226
225
major = {version_tuple[0]}
@@ -234,7 +233,6 @@ def test_pretend_metadata_with_version(
234
233
write_to = "src/version.py" , write_to_template = version_file_content
235
234
)
236
235
237
- # Read the file using pathlib
238
236
content = (wd .cwd / "src/version.py" ).read_text ()
239
237
assert "commit_hash = 'g1337beef'" in content
240
238
assert "num_commit = 4" in content
@@ -266,10 +264,8 @@ def test_pretend_metadata_without_version_warns(
266
264
# Let's create an empty git repo without commits to truly have no base version
267
265
monkeypatch .setenv (PRETEND_METADATA_KEY , '{node="g1234567", distance=2}' )
268
266
269
- # Should get a version with fallback but metadata overrides applied
270
267
with caplog .at_level (logging .WARNING ):
271
268
version = wd .get_version ()
272
- # Should get a fallback version with metadata overrides
273
269
assert version is not None
274
270
275
271
# In this case, metadata was applied to a fallback version, so no warning about missing base
@@ -301,7 +297,6 @@ def test_pretend_metadata_with_scm_version(
301
297
# Test version file to see if metadata was applied
302
298
wd .write ("setup.py" , SETUP_PY_PLAIN )
303
299
wd ("mkdir -p src" )
304
- # This is a template string, not an f-string - used by setuptools-scm templating
305
300
version_file_content = """
306
301
version = '{version}'
307
302
commit_hash = '{scm_version.short_node}'
@@ -403,7 +398,6 @@ def test_git_tag_with_local_build_data_preserved(wd: WorkDir) -> None:
403
398
f"Version should parse correctly as PEP 440: { version } "
404
399
)
405
400
406
- # Should preserve the build metadata that was in the git tag
407
401
assert version == "1.0.0+build.123" , (
408
402
f"Expected build metadata preserved, got { version } "
409
403
)
@@ -430,7 +424,6 @@ def test_git_tag_with_commit_hash_preserved(wd: WorkDir) -> None:
430
424
f"Version should parse correctly as PEP 440: { version } "
431
425
)
432
426
433
- # Should preserve the commit hash that was in the git tag
434
427
assert version == "2.0.0+sha.abcd1234"
435
428
436
429
# Validate the local part is correct
@@ -459,7 +452,6 @@ def test_git_tag_with_local_build_data_preserved_dirty_workdir(wd: WorkDir) -> N
459
452
f"Version should parse correctly as PEP 440: { version } "
460
453
)
461
454
462
- # Should preserve the build metadata that was in the git tag
463
455
assert version == "1.5.0+build.456" , (
464
456
f"Expected build metadata preserved with dirty workdir, got { version } "
465
457
)
0 commit comments