Opened 4 years ago

Last modified 3 years ago

#8478 enhancement new

Document how to test a deprecated class

Reported by: Adi Roiban Owned by: mark williams
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch: 8478-deprecated-class-test
branch-diff, diff-cov, branch-cov, buildbot

Change History (7)

comment:1 Changed 4 years ago by Adi Roiban

Description: modified (diff)

comment:2 Changed 4 years ago by Adi Roiban

Branch: 8478-deprecated-class-test
Keywords: review added
Owner: Adi Roiban deleted

Please check the associated branch add see if it make sense.

I have updated the documentation to talk about how to test deprecated module attributes.

I have re-arrange the current docs so that the example about how to run trial so that it fails on warnings has a greater visibility.


comment:3 Changed 4 years ago by mesozoic

This doesn't quite fix it, I think; test_RequestAvatarId_hashed would still cause an error because it's accessing a deprecated module attribute. It also bothers me to include hard-coded warning strings in our tests.

As you'd requested, I'm going to try to address this in a documentation patch as part of #8368. I'm also going to add a new test helper method, getDeprecatedModuleAttribute, which will retrieve the module attribute and make assertions about its deprecation status.

comment:4 Changed 4 years ago by Adi Roiban

Hi mesozoic, Feel free to push you changed to the associated branch.

My problem was that there were no examples on how to "properly" deprecate and test a class so I went for creating this branch to discuss and document what we agreed.


comment:5 Changed 4 years ago by Craig Rodrigues

Keywords: review removed
Owner: set to Adi Roiban

This document is not fully consistent with the docstring in twisted/python/ for how to deprecate fields, methods, classes and modules.

I suggest that both the document and the docstring be made consistent.

comment:6 Changed 3 years ago by mark williams

Owner: changed from Adi Roiban to mark williams

comment:7 Changed 3 years ago by Adi Roiban

Once comment about testing deprecation.

When we outsource a module, we should keep all the existing tests as they are in order to make sure that the API is not changed.

We should not evade the deprecation policy by outsourcing the package... the outsource packages should have the same quality standards as the Twisted project itself

Note: See TracTickets for help on using tickets.