enthought / traits

Observable typed attributes for Python classes
Other
432 stars 85 forks source link

Warn if a Trait default method raises AttributeError #1762

Closed mdickinson closed 8 months ago

mdickinson commented 10 months ago

Closes #1747

This PR issues a UserWarning when a *_default trait default method raises an AttributeError, to help detect an otherwise easy-to-miss failure mode.

Checklist

mdickinson commented 9 months ago

the test seems to only test one of the two code paths for the default generation

Good point; fixed in 4819297

I've also suppressed an instance of the new warning from an existing test in 45a2e1d.