I'm inclined to agree with this rationale.

> On Dec 8, 2024, at 6:32 AM, povi...@radix.lt wrote:
> 
> Hi,
> 
> I created this PR to remove TestCase.defer{SetUp, TestMethod, TearDown, 
> RunCleanups} methods: https://github.com/twisted/twisted/pull/12389
> 
> The justification is as follows:
> 
> Currently `TestCase` has the following functions that are presumably public 
> due to their naming: `deferSetUp`, `deferTestMethod`, `deferRunCleanups` and 
> `deferTearDown`. This raises a few problems. I suggest removing the functions 
> without deprecation period due to the following reasons:
> 
> - these functions expose so much of the internal structure of TestCase that 
> it makes the code hard to change (e.g. 
> https://github.com/twisted/twisted/pull/12375 cannot go in)
> 
> - there is no case where the functions would be useful as an extension point. 
> The only use of the functions that I found using Github code search is my own 
> code in the Buildbot project which overrides `deferRunCleanups` and hooks 
> even deeper into TestCase internals.

"it appears that nobody is using it at all" is the most convincing exception 
argument - eventually the policy is meant to support real users, and although 
not *all* of our users are public, if their code is not public _and_ they're 
not on this mailing list, we can't really expect to serve them. Thanks for 
checking through the github corpus!

> 
> - the API is not "public ready" (i.e. the `ignored` parameter) - it seems as 
> if they were some kind of internal thing that simply didn't get the `_` 
> prefix.
> 
> - deprecation would be harder to implement than usual, due to the functions 
> being supposed to be overridden, not just called.

I wonder if we could do anything with our deprecation helpers to make this 
easier to manage?  Inheritance does make this all unnecessarily more difficult.

> - this is API for tests, so it is not likely to break functionality that is 
> used in production. Only development workflows may be affected where the fix 
> is to update the tests.

This point isn't particularly convincing since the idea with the deprecation 
policy is that you can run your tests against the new version and get legible 
warning messages that you can correct; if we broke test functionality then you 
end up stuck.

> Given the above - small risk of breaking code for someone and relatively high 
> costs for going through the deprecation dance I would suggest to have an 
> exception for this change and allow to remove the functions without 
> deprecation period.
> 
> If you have any objections and you think that the functions should stay or at 
> least be removed via deprecation please let me know.
> 
> You can send your feedback by replying to this email or add your comment to 
> the PR
> 
> https://github.com/twisted/twisted/pull/12389
> 
> Thanks for your time!
> 
> Regards,
> Povilas



-g


_______________________________________________
Twisted mailing list -- twisted@python.org
To unsubscribe send an email to twisted-le...@python.org
https://mail.python.org/mailman3/lists/twisted.python.org/
Message archived at 
https://mail.python.org/archives/list/twisted@python.org/message/WK4G2T5TO2VFAF57U24DM5ZDVBU7P2I4/
Code of Conduct: https://twisted.org/conduct

Reply via email to