Add deprecation warning for apptools.undo#250
Conversation
…st importing from undo subpackage results in the warning
kitchoi
left a comment
There was a problem hiding this comment.
Two somewhat orthogonal issues:
(1) apptools test suite is emitting this deprecation warning. I believe they all come from the undo's own test suite. With that, they are false alarms and should be handled either by filtering the warning or by modifying the imports such that the warning is not emitted.
(2) The tests added are failing precisely because apptools test suite has already caused the warning to be emitted at import time. Importing the test module itself requiring importing __init__ prior to the test being run. Trying to import apptools.undo.api is not going to execute the module again because imported modules are cached.
I am not sure it is worth the effort in testing these import-time warnings. It is important though to make sure the __init__'s can still run, i.e. there are no silly syntax errors and the like that would prevent the entire package from being imported. Since there are tests in apptools.undo, the apptools.undo.__init__ is covered. But I am not sure if apptools.undo.action.__init__ has been covered by tests, could you check please?
I ran coverage on the undo tests, without the |
Right, it is probably covered by unittest discovery itself, fair enough. |
I tried adding a filter I am still seeing a warning. The warning it says is coming from |
Actually, we are fighting ourselves here. When we run the test suite, we set That's all because the warning is in |
Ah I see, that makes sense. I guess I will remove the warning filters then, as they aren't really doing anything |
|
Yep, SGTM. |
|
Should've looked at this before it was merged but this PR definitely needed a news fragment |
fixes #243
Pyface 7.2 is about to be release and as a result
apptools.undoneeds to be deprecated. This PR adds a deprecation warning toapptools.undo.__init__.pyandapptools.undo.action.__init__.pyso that importing fromapptools.undowill raise a deprecation warning. It also adds a test to verify deprecation warnings are raised when importing the api modules.Checklist