@@ -277,3 +277,44 @@ def test_weak_symbols_not_blacklisted() -> None:
277277 assert result .policies .libc == Libc .GLIBC
278278 assert result .policies .architecture == Architecture .x86_64
279279 assert result .overall_policy .name == "manylinux_2_17_x86_64"
280+
281+
282+ def test_symbol_blacklist (
283+ monkeypatch : pytest .MonkeyPatch ,
284+ capsys : pytest .CaptureFixture [str ],
285+ ) -> None :
286+ # wheel built using main@dda40c214e3db607b6ab31cd4cf9e3e5e1347937
287+ # AUDITWHEEL_ARCH=x86_64 nox -s tests-3.10 -- \
288+ # 'tests/integration/test_manylinux.py::TestManylinux::test_zlib_blacklist[manylinux_2_12]'
289+ wheel = HERE / "testzlib-0.0.1-cp310-cp310-linux_x86_64.whl"
290+ result = analyze_wheel_abi (
291+ None ,
292+ None ,
293+ wheel ,
294+ frozenset (),
295+ disable_isa_ext_check = False ,
296+ allow_graft = False ,
297+ )
298+ assert result .policies .libc == Libc .GLIBC
299+ assert result .policies .architecture == Architecture .x86_64
300+ assert result .overall_policy .name == "linux_x86_64"
301+ assert result .blacklist_policy .name == "linux_x86_64"
302+ assert result .sym_policy .name == "manylinux_2_12_x86_64"
303+ assert result .graft_policy .name == "manylinux_2_5_x86_64"
304+ assert result .machine_policy .name == "manylinux_2_5_x86_64"
305+ assert result .pyfpe_policy .name == "manylinux_2_5_x86_64"
306+ assert result .ref_policy .name == "manylinux_2_5_x86_64"
307+ assert result .ucs_policy .name == "manylinux_2_5_x86_64"
308+
309+ monkeypatch .setattr (sys , "platform" , "linux" )
310+ monkeypatch .setattr (Architecture , "detect" , lambda : Architecture .x86_64 )
311+ monkeypatch .setattr (sys , "argv" , ["auditwheel" , "repair" , str (wheel )])
312+ with pytest .raises (SystemExit ):
313+ main ()
314+ captured = capsys .readouterr ()
315+ assert " because it depends on black-listed symbols" in captured .err .replace ("\n " , " " )
316+
317+ monkeypatch .setattr (sys , "argv" , ["auditwheel" , "-v" , "show" , str (wheel )])
318+ main ()
319+ captured = capsys .readouterr ()
320+ assert "black-listed symbol dependencies" in captured .out .replace ("\n " , " " )
0 commit comments