pyproject-api icon indicating copy to clipboard operation
pyproject-api copied to clipboard

1.7.2: `test_setuptools_prepare_metadata_for_build_wheel` fails

Open mtelka opened this issue 1 year ago • 2 comments

_______________ test_setuptools_prepare_metadata_for_build_wheel _______________

frontend_setuptools = <pyproject_api._via_fresh_subprocess.SubprocessFrontend object at 0x7fffad561a30>
tmp_path = PosixPath('/tmp/pytest-of-marcel/pytest-21/test_setuptools_prepare_metada0')

    def test_setuptools_prepare_metadata_for_build_wheel(frontend_setuptools: SubprocessFrontend, tmp_path: Path) -> None:
        meta = tmp_path / "meta"
        result = frontend_setuptools.prepare_metadata_for_build_wheel(metadata_directory=meta)
        assert result is not None
        dist = Distribution.at(str(result.metadata))
        assert list(dist.entry_points) == [EntryPoint(name="demo_exe", value="demo:a", group="console_scripts")]
        assert dist.version == "1.0"
        assert dist.metadata["Name"] == "demo"
        values = [v for k, v in dist.metadata.items() if k == "Requires-Dist"]  # type: ignore[attr-defined]
        # ignore because "PackageMetadata" has no attribute "items"
>       assert sorted(values) == ["magic >3", "requests >2"]
E       AssertionError: assert ['magic>3', 'requests>2'] == ['magic >3', 'requests >2']
E
E         At index 0 diff: 'magic>3' != 'magic >3'
E
E         Full diff:
E           [
E         -     'magic >3',
E         ?           -
E         +     'magic>3',
E         -     'requests >2',
E         ?              -
E         +     'requests>2',
E           ]

tests/test_frontend_setuptools.py:76: AssertionError

To reproduce:

  1. download 1.7.2 sdist
  2. unpack it
  3. run tox -e py39

mtelka avatar Sep 18 '24 13:09 mtelka

Came across this while updating the Debian package too. It's broken by a newer version of setuptools (or at least in the Debian package of it).

Good: 70.3.0 Bad: 72.2.0, 73.0.1, 74.1.2

paravoid avatar Sep 20 '24 12:09 paravoid

Also ran into this on Arch Linux and we have a somewhat ancient setuptools (69.5.1).

I will disable this test as I guess this isn't really protect against what it's supposed to protect against :thinking:

dvzrv avatar Sep 22 '24 08:09 dvzrv

assuming https://github.com/tox-dev/pyproject-api/commit/81e9d2214d4904afefac2e7decad8d5c5cd95b45 was supposed to address this issue, the fix doesn't seem correct - we've just hit an issue with this on Alpine, and we run tests with Python 3.12:

        expected = ["magic>3", "requests>2"] if sys.version_info[0:2] > (3, 8) else ["magic >3", "requests >2"]
>       assert sorted(values) == expected
E       AssertionError: assert ['magic >3', 'requests >2'] == ['magic>3', 'requests>2']
E         
E         At index 0 diff: 'magic >3' != 'magic>3'
E         Use -v to get more diff

tests/test_frontend_setuptools.py:78: AssertionError

ptrcnull avatar Feb 23 '25 14:02 ptrcnull