Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make error message for specs without ".abi3." more prescriptive
Browse files Browse the repository at this point in the history
Say that the file path must contain `.abi3.` and check that this is
indeed the case in the corresponding test.
vadz committed Nov 7, 2024

Verified

This commit was signed with the committer’s verified signature.
SimonBrandner Šimon Brandner
1 parent a9c608a commit f45f422
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion abi3audit/_extract.py
Original file line number Diff line number Diff line change
@@ -104,7 +104,7 @@ def make_specs(val: str) -> list[Spec]:
# audited (e.g. via an abi3 wheel), but not directly (since
# without a tag here we don't know if it's abi3 at all).
if ".abi3." not in val:
raise InvalidSpec(f"'{val}' looks like a shared object but is not tagged as abi3")
raise InvalidSpec(f"'{val}' must contain '.abi3.' to be recognized as a shared object")
return [SharedObjectSpec(val)]
elif re.match(_DISTRIBUTION_NAME_RE, val, re.IGNORECASE):
return [PyPISpec(val)]
2 changes: 1 addition & 1 deletion test/test_extract.py
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ def test_make_spec():
assert make_specs("foo") == [PyPISpec("foo")]

# Shared objects need to be tagged with `.abi3`.
with pytest.raises(InvalidSpec):
with pytest.raises(InvalidSpec, match="'foo.so' must contain '.abi3.'"):
make_specs("foo.so")

# Anything that doesn't look like a wheel, shared object, or PyPI package fails.

0 comments on commit f45f422

Please sign in to comment.