Skip to content

Commit

Permalink
tests: support setuptools v69.0.3+ (#722)
Browse files Browse the repository at this point in the history
* tests: support setuptools v69.0.3+

Signed-off-by: Henry Schreiner <[email protected]>

* tests: missed one more normalization fix

Signed-off-by: Henry Schreiner <[email protected]>

* fix: add MANIFEST.in for old setuptools in tests

Signed-off-by: Henry Schreiner <[email protected]>

* tests: used the wrong name

Signed-off-by: Henry Schreiner <[email protected]>

---------

Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored Jan 17, 2024
1 parent ee4a880 commit 9f6e342
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions tests/packages/test-setuptools/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include pyproject.toml setup.cfg
6 changes: 4 additions & 2 deletions tests/test_projectbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,8 @@ def test_metadata_path_no_prepare(tmp_dir, package_test_no_prepare):
pathlib.Path(builder.metadata_path(tmp_dir)),
).metadata

assert metadata['name'] == 'test-no-prepare'
# Setuptools < v69.0.3 (https://github.com/pypa/setuptools/pull/4159) normalized this to dashes
assert metadata['name'].replace('-', '_') == 'test_no_prepare'
assert metadata['Version'] == '1.0.0'


Expand All @@ -513,7 +514,8 @@ def test_metadata_path_with_prepare(tmp_dir, package_test_setuptools):
pathlib.Path(builder.metadata_path(tmp_dir)),
).metadata

assert metadata['name'] == 'test-setuptools'
# Setuptools < v69.0.3 (https://github.com/pypa/setuptools/pull/4159) normalized this to dashes
assert metadata['name'].replace('-', '_') == 'test_setuptools'
assert metadata['Version'] == '1.0.0'


Expand Down
1 change: 1 addition & 0 deletions tests/test_self_packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
'tests/constraints.txt',
'tests/packages/test-cant-build-via-sdist/some-file-that-is-needed-for-build.txt',
'tests/packages/test-no-project/empty.txt',
'tests/packages/test-setuptools/MANIFEST.in',
'tox.ini',
}

Expand Down
6 changes: 4 additions & 2 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
def test_wheel_metadata(package_test_setuptools, isolated):
metadata = build.util.project_wheel_metadata(package_test_setuptools, isolated)

assert metadata['name'] == 'test-setuptools'
# Setuptools < v69.0.3 (https://github.com/pypa/setuptools/pull/4159) normalized this to dashes
assert metadata['name'].replace('-', '_') == 'test_setuptools'
assert metadata['version'] == '1.0.0'
assert isinstance(metadata.json, dict)

Expand Down Expand Up @@ -41,7 +42,8 @@ def test_wheel_metadata_isolation(package_test_flit):
def test_with_get_requires(package_test_metadata):
metadata = build.util.project_wheel_metadata(package_test_metadata)

assert metadata['name'] == 'test-metadata'
# Setuptools < v69.0.3 (https://github.com/pypa/setuptools/pull/4159) normalized this to dashes
assert metadata['name'].replace('-', '_') == 'test_metadata'
assert str(metadata['version']) == '1.0.0'
assert metadata['summary'] == 'hello!'
assert isinstance(metadata.json, dict)

0 comments on commit 9f6e342

Please sign in to comment.