Skip to content

Commit 44e1731

Browse files
committed
Fixed test failures
1 parent 1a82c45 commit 44e1731

File tree

3 files changed

+42
-9
lines changed

3 files changed

+42
-9
lines changed

setuptools/command/bdist_wheel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ class bdist_wheel(Command):
230230

231231
boolean_options = ["keep-temp", "skip-build", "relative", "universal"]
232232

233-
def initialize_options(self):
234-
self.bdist_dir: str = None
233+
def initialize_options(self) -> None:
234+
self.bdist_dir: str | None = None
235235
self.data_dir = None
236236
self.plat_name: str | None = None
237237
self.plat_tag = None

setuptools/tests/test_bdist_wheel.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import subprocess
1111
import sys
1212
import sysconfig
13+
from functools import partial
1314
from inspect import cleandoc
1415
from unittest.mock import Mock
1516
from zipfile import ZipFile
@@ -57,6 +58,40 @@
5758
"""
5859

5960

61+
@pytest.fixture(scope="module")
62+
def wheel_paths(request, tmp_path_factory):
63+
test_distributions = (
64+
"complex-dist",
65+
"simple.dist",
66+
"headers.dist",
67+
"commasinfilenames.dist",
68+
"unicode.dist",
69+
)
70+
71+
if sys.platform != "win32":
72+
# ABI3 extensions don't really work on Windows
73+
test_distributions += ("abi3extension.dist",)
74+
75+
pwd = os.path.abspath(os.curdir)
76+
request.addfinalizer(partial(os.chdir, pwd))
77+
this_dir = os.path.dirname(__file__)
78+
build_dir = tmp_path_factory.mktemp("build")
79+
dist_dir = tmp_path_factory.mktemp("dist")
80+
for dist in test_distributions:
81+
os.chdir(os.path.join(this_dir, "bdist_wheel_testdata", dist))
82+
subprocess.check_call([
83+
sys.executable,
84+
"setup.py",
85+
"bdist_wheel",
86+
"-b",
87+
str(build_dir),
88+
"-d",
89+
str(dist_dir),
90+
])
91+
92+
return sorted(str(fname) for fname in dist_dir.iterdir() if fname.suffix == ".whl")
93+
94+
6095
@pytest.fixture
6196
def dummy_dist(tmp_path_factory):
6297
basedir = tmp_path_factory.mktemp("dummy_dist")
@@ -227,7 +262,7 @@ def test_build_number(dummy_dist, monkeypatch, tmp_path):
227262
def test_limited_abi(monkeypatch, tmp_path):
228263
"""Test that building a binary wheel with the limited ABI works."""
229264
this_dir = os.path.dirname(__file__)
230-
source_dir = os.path.join(this_dir, "testdata", "extension.dist")
265+
source_dir = os.path.join(this_dir, "bdist_wheel_testdata", "extension.dist")
231266
build_dir = tmp_path.joinpath("build")
232267
dist_dir = tmp_path.joinpath("dist")
233268
monkeypatch.chdir(source_dir)

setuptools/tests/test_build_meta.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def build_backend(self, tmpdir, request):
232232

233233
def test_get_requires_for_build_wheel(self, build_backend):
234234
actual = build_backend.get_requires_for_build_wheel()
235-
expected = ['six', 'wheel']
235+
expected = ['six']
236236
assert sorted(actual) == sorted(expected)
237237

238238
def test_get_requires_for_build_sdist(self, build_backend):
@@ -783,14 +783,12 @@ def run():
783783
build_backend = self.get_build_backend()
784784

785785
if use_wheel:
786-
base_requirements = ['wheel']
787786
get_requires = build_backend.get_requires_for_build_wheel
788787
else:
789-
base_requirements = []
790788
get_requires = build_backend.get_requires_for_build_sdist
791789

792790
# Ensure that the build requirements are properly parsed
793-
expected = sorted(base_requirements + requirements)
791+
expected = sorted(requirements)
794792
actual = get_requires()
795793

796794
assert expected == sorted(actual)
@@ -821,7 +819,7 @@ def test_setup_requires_with_auto_discovery(self, tmpdir_cwd):
821819
path.build(files)
822820
build_backend = self.get_build_backend()
823821
setup_requires = build_backend.get_requires_for_build_wheel()
824-
assert setup_requires == ["wheel", "foo"]
822+
assert setup_requires == ["foo"]
825823

826824
def test_dont_install_setup_requires(self, tmpdir_cwd):
827825
files = {
@@ -963,7 +961,7 @@ def test_sys_exit_0_in_setuppy(monkeypatch, tmp_path):
963961
"""
964962
(tmp_path / "setup.py").write_text(DALS(setuppy), encoding="utf-8")
965963
backend = BuildBackend(backend_name="setuptools.build_meta")
966-
assert backend.get_requires_for_build_wheel() == ["wheel"]
964+
assert backend.get_requires_for_build_wheel() == []
967965

968966

969967
def test_system_exit_in_setuppy(monkeypatch, tmp_path):

0 commit comments

Comments
 (0)