Skip to content

Commit cbb059d

Browse files
committed
Add more unit tests for get_policy_name & get_priority_by_name
1 parent 2be9482 commit cbb059d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/unit/test_policy.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ def test_get_by_priority(self):
5555
def test_get_by_priority_missing(self):
5656
assert get_policy_name(101) is None
5757

58+
@patch("auditwheel.policy._POLICIES", [
59+
{"name": "duplicate", "priority": 0},
60+
{"name": "duplicate", "priority": 0},
61+
])
62+
def test_get_by_priority_duplicate(self):
63+
with pytest.raises(RuntimeError):
64+
get_policy_name(0)
65+
5866
def test_get_by_name(self):
5967
_arch = get_arch_name()
6068
assert get_priority_by_name(f"manylinux2014_{_arch}") == 80
@@ -65,3 +73,11 @@ def test_get_by_name(self):
6573
def test_get_by_name_missing(self):
6674
assert get_priority_by_name("nosuchpolicy") is None
6775

76+
@patch("auditwheel.policy._POLICIES", [
77+
{"name": "duplicate", "priority": 0},
78+
{"name": "duplicate", "priority": 0},
79+
])
80+
def test_get_by_name_duplicate(self):
81+
with pytest.raises(RuntimeError):
82+
get_priority_by_name("duplicate")
83+

0 commit comments

Comments
 (0)