From cd34c95d220f75cd71e305889773200da70f757d Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Mon, 15 Aug 2022 17:39:11 +0100 Subject: Reproduce error in issue 3522 --- setuptools/tests/test_editable_install.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'setuptools') diff --git a/setuptools/tests/test_editable_install.py b/setuptools/tests/test_editable_install.py index 900ec1b3..58a74100 100644 --- a/setuptools/tests/test_editable_install.py +++ b/setuptools/tests/test_editable_install.py @@ -5,6 +5,7 @@ import subprocess import platform from copy import deepcopy from importlib import import_module +from importlib.machinery import EXTENSION_SUFFIXES from pathlib import Path from textwrap import dedent from unittest.mock import Mock @@ -28,6 +29,7 @@ from setuptools.command.editable_wheel import ( editable_wheel, ) from setuptools.dist import Distribution +from setuptools.extension import Extension @pytest.fixture(params=["strict", "lenient"]) @@ -877,6 +879,35 @@ class TestCustomBuildWheel: assert wheel_file.endswith(".whl") +class TestCustomBuildExt: + def install_custom_build_ext_distutils(self, dist): + from distutils.command.build_ext import build_ext as build_ext_cls + + class MyBuildExt(build_ext_cls): + pass + + dist.cmdclass["build_ext"] = MyBuildExt + + def test_distutils_leave_inplace_files(self, tmpdir_cwd): + jaraco.path.build({"module.c": ""}) + attrs = { + "ext_modules": [Extension("module", ["module.c"])], + } + dist = Distribution(attrs) + dist.script_name = "setup.py" + dist.set_defaults() + self.install_custom_build_ext_distutils(dist) + cmd = editable_wheel(dist) + cmd.ensure_finalized() + cmd.run() + wheel_file = str(next(Path().glob('dist/*'))) + assert "editable" in wheel_file + files = [p for p in Path().glob("module.*") if p.suffix != ".c"] + assert len(files) == 1 + name = files[0].name + assert any(name.endswith(ext) for ext in EXTENSION_SUFFIXES) + + def install_project(name, venv, tmp_path, files, *opts): project = tmp_path / name project.mkdir() -- cgit v1.2.1