Skip to content

Commit f437450

Browse files
committed
add tests for auditwheel show
1 parent d8e7826 commit f437450

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

tests/integration/test_bundled_wheels.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from auditwheel import lddtree, main_repair
1919
from auditwheel.architecture import Architecture
2020
from auditwheel.libc import Libc
21+
from auditwheel.main import main
2122
from auditwheel.wheel_abi import NonPlatformWheel, analyze_wheel_abi
2223

2324
HERE = Path(__file__).parent.resolve()
@@ -94,6 +95,16 @@ def test_analyze_wheel_abi_pyfpe():
9495
assert winfo.overall_policy.name == "linux_x86_64"
9596

9697

98+
def test_show_wheel_abi_pyfpe(monkeypatch, capsys):
99+
wheel = str(HERE / "fpewheel-0.0.0-cp35-cp35m-linux_x86_64.whl")
100+
monkeypatch.setattr(sys, "platform", "linux")
101+
monkeypatch.setattr(platform, "machine", lambda: "x86_64")
102+
monkeypatch.setattr(sys, "argv", ["auditwheel", "show", wheel])
103+
assert main() == 0
104+
captured = capsys.readouterr()
105+
assert "This wheel uses the PyFPE_jbuf function" in captured.out
106+
107+
97108
def test_analyze_wheel_abi_bad_architecture():
98109
with pytest.raises(NonPlatformWheel):
99110
analyze_wheel_abi(

tests/unit/test_main.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import platform
34
import sys
45

56
import pytest
@@ -34,3 +35,16 @@ def test_help(monkeypatch, capsys):
3435
assert retval is None
3536
captured = capsys.readouterr()
3637
assert "usage: auditwheel [-h] [-V] [-v] command ..." in captured.out
38+
39+
40+
def test_show_unexisting_wheel(monkeypatch, capsys, tmp_path):
41+
monkeypatch.setattr(sys, "platform", "linux")
42+
monkeypatch.setattr(platform, "machine", lambda: "x86_64")
43+
wheel = str(tmp_path / "not-a-file.whl")
44+
monkeypatch.setattr(sys, "argv", ["dummy", "show", wheel])
45+
46+
with pytest.raises(SystemExit):
47+
main()
48+
49+
captured = capsys.readouterr()
50+
assert "No such file" in captured.err

0 commit comments

Comments
 (0)