diff options
| author | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-08-12 19:41:13 +0100 |
|---|---|---|
| committer | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-08-12 19:41:13 +0100 |
| commit | d7f5704cbc8e739fe6144402a6c2ed45e38cd6c0 (patch) | |
| tree | 78f7c93ef7dee574442adf3be3336fb1f854fd6a /setuptools/tests | |
| parent | e4dd4bdd923cfc2f69dd4cfbb119644bb46e5e9d (diff) | |
| parent | c380214475ebbd3e93d15ebcfc0bd691f6c2e5a0 (diff) | |
| download | python-setuptools-git-d7f5704cbc8e739fe6144402a6c2ed45e38cd6c0.tar.gz | |
Fix other problems with editable installs (#3517)
1. Ensure commands are finalized, to ensure plat_name is set.
2. Filter out temporary source files and prevent setuptools for
attempting to consider them as part of the data_files/package_data
list
Diffstat (limited to 'setuptools/tests')
| -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..900ec1b3 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 bdist_wheel 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 = str(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() |
