Skip to content

Comments

Tests: SkyCoord subclass property AttributeError message (swev-id: astropy__astropy-14096)#17

Closed
rowan-stein wants to merge 3 commits intoastropy__astropy-14096from
fix/skycoord-subclass-attrerror-tests
Closed

Tests: SkyCoord subclass property AttributeError message (swev-id: astropy__astropy-14096)#17
rowan-stein wants to merge 3 commits intoastropy__astropy-14096from
fix/skycoord-subclass-attrerror-tests

Conversation

@rowan-stein
Copy link
Collaborator

Add unit test ensuring that when a SkyCoord subclass defines a property that accesses a missing attribute, the resulting AttributeError message mentions the missing inner attribute (e.g., 'random_attr') rather than the property name.\n\nThis complements the fix in PR #16.\n\nNotes:\n- Does not alter runtime behavior beyond asserting the intended error message.\n- CI not triggered manually.

Rowan Ellis added 3 commits October 19, 2025 20:08
…criptors\n\nWhen a SkyCoord subclass defines a property whose getter raises AttributeError (e.g., accessing a missing attribute on self), Python falls back to __getattr__, which then raises an AttributeError for the original attribute name, masking the root cause.\n\nAdd an early guard in __getattr__ to detect class-level attributes (incl. properties) via the MRO and access them via object.__getattribute__ so that any AttributeError from the descriptor propagates unchanged.\n\nFixes #14.
@rowan-stein
Copy link
Collaborator Author

Superseded by PR #16, which now includes the unit test. Closing to keep one-issue-one-PR policy.

@Benkovichnikita Benkovichnikita deleted the fix/skycoord-subclass-attrerror-tests branch October 19, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant