Skip to content

Commit 26389ff

Browse files
committed
test: Add test for allowed symbols
1 parent 6f084ed commit 26389ff

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test/test_audit_unit.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import pytest
55
from abi3info.models import Function, PyVersion, Symbol
66

7+
from abi3audit._audit import _ALLOWED_SYMBOLS as ALLOWED_SYMBOLS
78
from abi3audit._audit import audit
89

910

@@ -81,12 +82,24 @@ def __iter__(self) -> Iterator[Symbol]:
8182
Symbol("Py_foo_bar", None),
8283
],
8384
),
85+
SharedObject(
86+
baseline=PyVersion(3, 10),
87+
computed=PyVersion(3, 10),
88+
symbols=[
89+
Symbol("PyType_GetModule", "global"),
90+
Symbol("Py_abi3audit_allowed_symbol", "global"),
91+
],
92+
),
8493
]
8594

8695

8796
@pytest.mark.parametrize("so", shared_objects)
8897
def test_audit_result_unit_test(so):
89-
result = audit(so, so.baseline)
98+
ALLOWED_SYMBOLS.add("Py_abi3audit_allowed_symbol")
99+
try:
100+
result = audit(so, so.baseline)
101+
finally:
102+
ALLOWED_SYMBOLS.remove("Py_abi3audit_allowed_symbol")
90103
assert result.baseline == so.baseline
91104
assert result.computed == so.computed
92105
assert result.future_abi3_objects == set(so.future_abi3_objects)

0 commit comments

Comments
 (0)