1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
From acee12430753e8350435d4304196e8eaa654ccd6 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Mon, 3 Jun 2024 20:47:20 +1000
Subject: [PATCH] Support setuptools 69.3.0 changes in four tests
setuptools 69.3.0 now canonicalizes package names in filenames, which
means all dashes are now converted to underscores, leading to test
failures due to FileNotFoundErrors. Handle both cases to support older
and newer setuptools.
---
tests/test_hello_cython.py | 23 ++++++++++++++---------
tests/test_hello_fortran.py | 29 +++++++++++++++++------------
tests/test_hello_pure.py | 15 ++++++++++-----
tests/test_manifest_in.py | 17 +++++++++++------
4 files changed, 52 insertions(+), 32 deletions(-)
diff --git a/tests/test_hello_cython.py b/tests/test_hello_cython.py
index dc95f697..1d9e944d 100644
--- a/tests/test_hello_cython.py
+++ b/tests/test_hello_cython.py
@@ -29,20 +29,25 @@ def test_hello_cython_sdist():
sdists_zip = glob.glob("dist/*.zip")
assert sdists_tar or sdists_zip
+ dirname = "hello-cython-1.2.3"
+ # setuptools 69.3.0 and above now canonicalize the filename as well.
+ if any("hello_cython" in x for x in sdists_zip + sdists_tar):
+ dirname = "hello_cython-1.2.3"
+
expected_content = [
- "hello-cython-1.2.3/CMakeLists.txt",
- "hello-cython-1.2.3/hello/_hello.pyx",
- "hello-cython-1.2.3/hello/CMakeLists.txt",
- "hello-cython-1.2.3/hello/__init__.py",
- "hello-cython-1.2.3/hello/__main__.py",
- "hello-cython-1.2.3/setup.py",
+ f"{dirname}/CMakeLists.txt",
+ f"{dirname}/hello/_hello.pyx",
+ f"{dirname}/hello/CMakeLists.txt",
+ f"{dirname}/hello/__init__.py",
+ f"{dirname}/hello/__main__.py",
+ f"{dirname}/setup.py",
]
- sdist_archive = "dist/hello-cython-1.2.3.zip"
+ sdist_archive = f"dist/{dirname}.zip"
if sdists_tar:
- sdist_archive = "dist/hello-cython-1.2.3.tar.gz"
+ sdist_archive = f"dist/{dirname}.tar.gz"
- check_sdist_content(sdist_archive, "hello-cython-1.2.3", expected_content, package_dir="hello")
+ check_sdist_content(sdist_archive, dirname, expected_content, package_dir="hello")
@project_setup_py_test("hello-cython", ["bdist_wheel"])
diff --git a/tests/test_hello_fortran.py b/tests/test_hello_fortran.py
index 41f5f444..be9cede9 100644
--- a/tests/test_hello_fortran.py
+++ b/tests/test_hello_fortran.py
@@ -33,23 +33,28 @@ def test_hello_fortran_sdist():
sdists_zip = glob.glob("dist/*.zip")
assert sdists_tar or sdists_zip
+ dirname = "hello-fortran-1.2.3"
+ # setuptools 69.3.0 and above now canonicalize the filename as well.
+ if any("hello_fortran" in x for x in sdists_zip + sdists_tar):
+ dirname = "hello_fortran-1.2.3"
+
expected_content = [
- "hello-fortran-1.2.3/bonjour/_bonjour.f90",
- "hello-fortran-1.2.3/bonjour/_bonjour.pyf",
- "hello-fortran-1.2.3/bonjour/CMakeLists.txt",
- "hello-fortran-1.2.3/CMakeLists.txt",
- "hello-fortran-1.2.3/hello/_hello.f90",
- "hello-fortran-1.2.3/hello/CMakeLists.txt",
- "hello-fortran-1.2.3/hello/__init__.py",
- "hello-fortran-1.2.3/hello/__main__.py",
- "hello-fortran-1.2.3/setup.py",
+ f"{dirname}/bonjour/_bonjour.f90",
+ f"{dirname}/bonjour/_bonjour.pyf",
+ f"{dirname}/bonjour/CMakeLists.txt",
+ f"{dirname}/CMakeLists.txt",
+ f"{dirname}/hello/_hello.f90",
+ f"{dirname}/hello/CMakeLists.txt",
+ f"{dirname}/hello/__init__.py",
+ f"{dirname}/hello/__main__.py",
+ f"{dirname}/setup.py",
]
- sdist_archive = "dist/hello-fortran-1.2.3.zip"
+ sdist_archive = f"dist/{dirname}.zip"
if sdists_tar:
- sdist_archive = "dist/hello-fortran-1.2.3.tar.gz"
+ sdist_archive = f"dist/{dirname}.tar.gz"
- check_sdist_content(sdist_archive, "hello-fortran-1.2.3", expected_content)
+ check_sdist_content(sdist_archive, dirname, expected_content)
@pytest.mark.fortran()
diff --git a/tests/test_hello_pure.py b/tests/test_hello_pure.py
index 21b0840b..cc176854 100644
--- a/tests/test_hello_pure.py
+++ b/tests/test_hello_pure.py
@@ -27,16 +27,21 @@ def test_hello_pure_sdist():
sdists_zip = glob.glob("dist/*.zip")
assert sdists_tar or sdists_zip
+ dirname = "hello-pure-1.2.3"
+ # setuptools 69.3.0 and above now canonicalize the filename as well.
+ if any("hello_pure" in x for x in sdists_zip + sdists_tar):
+ dirname = "hello_pure-1.2.3"
+
expected_content = [
- "hello-pure-1.2.3/hello/__init__.py",
- "hello-pure-1.2.3/setup.py",
+ f"{dirname}/hello/__init__.py",
+ f"{dirname}/setup.py",
]
- sdist_archive = "dist/hello-pure-1.2.3.zip"
+ sdist_archive = f"dist/{dirname}.zip"
if sdists_tar:
- sdist_archive = "dist/hello-pure-1.2.3.tar.gz"
+ sdist_archive = f"dist/{dirname}.tar.gz"
- check_sdist_content(sdist_archive, "hello-pure-1.2.3", expected_content)
+ check_sdist_content(sdist_archive, dirname, expected_content)
@project_setup_py_test("hello-pure", ["bdist_wheel"], disable_languages_test=True)
diff --git a/tests/test_manifest_in.py b/tests/test_manifest_in.py
index 86652308..65c23d1a 100644
--- a/tests/test_manifest_in.py
+++ b/tests/test_manifest_in.py
@@ -21,17 +21,22 @@ def test_manifest_in_sdist():
sdists_zip = glob.glob("dist/*.zip")
assert sdists_tar or sdists_zip
+ dirname = "manifest-in-1.2.3"
+ # setuptools 69.3.0 and above now canonicalize the filename as well.
+ if any("manifest_in" in x for x in sdists_zip + sdists_tar):
+ dirname = "manifest_in-1.2.3"
+
expected_content = [
- "manifest-in-1.2.3/hello/__init__.py",
- "manifest-in-1.2.3/setup.py",
- "manifest-in-1.2.3/MANIFEST.in",
+ f"{dirname}/hello/__init__.py",
+ f"{dirname}/setup.py",
+ f"{dirname}/MANIFEST.in",
]
- sdist_archive = "dist/manifest-in-1.2.3.zip"
+ sdist_archive = f"dist/{dirname}.zip"
if sdists_tar:
- sdist_archive = "dist/manifest-in-1.2.3.tar.gz"
+ sdist_archive = f"dist/{dirname}.tar.gz"
- check_sdist_content(sdist_archive, "manifest-in-1.2.3", expected_content)
+ check_sdist_content(sdist_archive, dirname, expected_content)
@project_setup_py_test("manifest-in", ["bdist_wheel"], disable_languages_test=True)
|