Skip to content

Commit b94ddbd

Browse files
dnicolodirgommers
authored andcommitted
TST: simplify and fix test
1 parent 1d4a950 commit b94ddbd

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

tests/test_wheel.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434
if sys.platform in {'win32', 'cygwin'}:
3535
EXT_IMP_SUFFIX = re.sub(r'.(pyd|dll)$', '.lib' if shutil.which('cl.exe') else '.dll.a', EXT_SUFFIX)
3636

37+
LIB_SUFFIX = {
38+
'cygwin': '.dll',
39+
'darwin': '.dylib',
40+
'linux': '.so',
41+
'win32': '.dll',
42+
}[sys.platform]
43+
3744
# Test against the wheel tag generated by packaging module.
3845
tag = next(packaging.tags.sys_tags())
3946
ABI = tag.abi
@@ -137,16 +144,14 @@ def test_contents_license_file(wheel_license_file):
137144
def test_contents(package_library, wheel_library):
138145
artifact = wheel.wheelfile.WheelFile(wheel_library)
139146

140-
for name, regex in zip(sorted(wheel_contents(artifact)), [
141-
re.escape('.library.mesonpy.libs/libexample.so'),
142-
re.escape('library-1.0.0.data/headers/examplelib.h'),
143-
re.escape('library-1.0.0.data/scripts/example'),
144-
re.escape('library-1.0.0.dist-info/METADATA'),
145-
re.escape('library-1.0.0.dist-info/RECORD'),
146-
re.escape('library-1.0.0.dist-info/WHEEL'),
147-
re.escape('library.libs/libexample.so'),
148-
]):
149-
assert re.match(regex, name), f'{name!r} does not match {regex!r}'
147+
assert wheel_contents(artifact) == {
148+
f'.library.mesonpy.libs/libexample{LIB_SUFFIX}',
149+
'library-1.0.0.data/headers/examplelib.h',
150+
'library-1.0.0.data/scripts/example',
151+
'library-1.0.0.dist-info/METADATA',
152+
'library-1.0.0.dist-info/RECORD',
153+
'library-1.0.0.dist-info/WHEEL',
154+
}
150155

151156

152157
@pytest.mark.skipif(platform.system() not in {'Linux', 'Darwin'}, reason='Not supported on this platform')

0 commit comments

Comments
 (0)