diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:20:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:20:41 +0000 |
commit | b49f1524e250764592ff132af8fb0d39182620f7 (patch) | |
tree | a2c4da0c1bfc3be79c9b80180d8958804e91a07d /tests/test_util.py | |
parent | Initial commit. (diff) | |
download | python-build-b49f1524e250764592ff132af8fb0d39182620f7.tar.xz python-build-b49f1524e250764592ff132af8fb0d39182620f7.zip |
Adding upstream version 0.9.0.upstream/0.9.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/test_util.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/test_util.py b/tests/test_util.py new file mode 100644 index 0000000..9f090b5 --- /dev/null +++ b/tests/test_util.py @@ -0,0 +1,44 @@ +# SPDX-License-Identifier: MIT + +import pytest + +import build.util + + +@pytest.mark.pypy3323bug +@pytest.mark.parametrize('isolated', [False, True]) +def test_wheel_metadata(package_test_setuptools, isolated): + metadata = build.util.project_wheel_metadata(package_test_setuptools, isolated) + + assert metadata['name'] == 'test-setuptools' + assert metadata['version'] == '1.0.0' + + +@pytest.mark.pypy3323bug +def test_wheel_metadata_isolation(package_test_flit): + try: + import flit_core # noqa: F401 + except ModuleNotFoundError: + pass + else: + pytest.xfail('flit_core is available -- we want it missing!') # pragma: no cover + + metadata = build.util.project_wheel_metadata(package_test_flit) + + assert metadata['name'] == 'test_flit' + assert metadata['version'] == '1.0.0' + + with pytest.raises( + build.BuildBackendException, + match="Backend 'flit_core.buildapi' is not available.", + ): + build.util.project_wheel_metadata(package_test_flit, isolated=False) + + +@pytest.mark.pypy3323bug +def test_with_get_requires(package_test_metadata): + metadata = build.util.project_wheel_metadata(package_test_metadata) + + assert metadata['name'] == 'test-metadata' + assert str(metadata['version']) == '1.0.0' + assert metadata['summary'] == 'hello!' |