diff options
| -rw-r--r-- | setuptools/tests/test_editable_install.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/setuptools/tests/test_editable_install.py b/setuptools/tests/test_editable_install.py index 67d377ef..ecb6e509 100644 --- a/setuptools/tests/test_editable_install.py +++ b/setuptools/tests/test_editable_install.py @@ -25,6 +25,7 @@ from setuptools.command.editable_wheel import ( _find_namespaces, _find_package_roots, _finder_template, + editable_wheel, ) from setuptools.dist import Distribution @@ -846,6 +847,36 @@ class TestCustomBuildPy: assert b"42" in out +class TestCustomBuildWheel: + def install_custom_build_wheel(self, dist): + bdist_wheel_cls = dist.get_command_class("bdist_wheel") + + class MyBdistWheel(bdist_wheel_cls): + def get_tag(self): + # In issue #3513, we can see that some extensions may try to access + # the `plat_name` property in bdist_wheel + if self.plat_name.startswith("macosx-"): + _ = "macOS platform" + return super().get_tag() + + dist.cmdclass["bdist_wheel"] = MyBdistWheel + + def test_access_plat_name(self, tmpdir_cwd): + # Even when a custom build step tries to access plat_name the build should + # be successful + jaraco.path.build({"module.py": "x = 42"}) + dist = Distribution() + dist.script_name = "setup.py" + dist.set_defaults() + self.install_custom_build_wheel(dist) + cmd = editable_wheel(dist) + cmd.ensure_finalized() + cmd.run() + wheel_file = next(Path().glob('dist/*')) + assert "editable" in wheel_file + assert wheel_file.endswith(".whl") + + def install_project(name, venv, tmp_path, files, *opts): project = tmp_path / name project.mkdir() |
