Skip to content

Commit

Permalink
add test to verify import error
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Oct 6, 2024
1 parent 792d045 commit 2b674c1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@ def test_importing_invalid_attr_raises():
match = r"^module 'propcache' has no attribute 'invalid_attr'$"
with pytest.raises(AttributeError, match=match):
propcache.invalid_attr


def test_import_error_invalid_attr():
"""Verify importing an invalid attribute raises an ImportError."""
# No match here because the error is raised by the import system
# and may vary between Python versions.
with pytest.raises(ImportError):
from propcache import invalid_attr # noqa: F401

0 comments on commit 2b674c1

Please sign in to comment.