[Twisted-Python] failUnlessFailure vs assertFailure
Hi, Do you know why we still have failUnlessFailure is an alias to assertFailure? [1] It looks like pydoctor does not include aliases as I don't see failUnlessFailure in the HTML rendering http://twistedmatrix.com/documents/current/api/twisted.trial.unittest.TestCa... Looking at the current code, I see that it is used only in a single place in Twisted https://github.com/twisted/twisted/search?utf8=%E2%9C%93&q=failUnlessFailure&type= I see that in the past assertFailure was an alias for failUnlessFailure [2] Is the plan to continue to have the alias? Maybe we can have a comment before the alias. Can we deprecate it? Should pydoctor be updated to also show aliases of public methods? Regards, [1] https://github.com/twisted/twisted/blob/e38cc25a67747899c6984d6ebaa8d3d13479... [2] https://github.com/twisted/twisted/commit/ce0b00de026a896b731d8794de2fd61b54... -- Adi Roiban
Probably failUnlessFailure as an alias to assertFailure() was done to mimic some of the deprecations that occurred in the Python unittest module in Python 2.7: https://docs.python.org/2/library/unittest.html#deprecated-aliases It would probably be a good idea to change the usage of failUnlessFailure in twisted to assertFailure, and then deprecate failUnlessFailure. -- Craig On Wed, Jan 3, 2018 at 6:29 AM, Adi Roiban <adi@roiban.ro> wrote:
Hi,
Do you know why we still have failUnlessFailure is an alias to assertFailure? [1]
It looks like pydoctor does not include aliases as I don't see failUnlessFailure in the HTML rendering http://twistedmatrix.com/documents/current/api/twisted. trial.unittest.TestCase.html
Looking at the current code, I see that it is used only in a single place in Twisted https://github.com/twisted/twisted/search?utf8=%E2%9C%93& q=failUnlessFailure&type=
I see that in the past assertFailure was an alias for failUnlessFailure [2]
Is the plan to continue to have the alias? Maybe we can have a comment before the alias.
Can we deprecate it?
Should pydoctor be updated to also show aliases of public methods?
Regards,
[1] https://github.com/twisted/twisted/blob/e38cc25a67747899c6984d6ebaa8d3 d134799415/src/twisted/trial/_asynctest.py#L77
[2] https://github.com/twisted/twisted/commit/ ce0b00de026a896b731d8794de2fd61b54a78a98 -- Adi Roiban
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
On Jan 3, 2018, at 1:19 PM, Craig Rodrigues <rodrigc@crodrigues.org> wrote:
Probably failUnlessFailure as an alias to assertFailure() was done to mimic some of the deprecations that occurred in the Python unittest module in Python 2.7: https://docs.python.org/2/library/unittest.html#deprecated-aliases <https://docs.python.org/2/library/unittest.html#deprecated-aliases>
It would probably be a good idea to change the usage of failUnlessFailure in twisted to assertFailure, and then deprecate failUnlessFailure.
This is a roughly accurate summary. One minor quibble: it wasn't done to mimic "deprecations" - the failUnless aliases have been around since the very first release of PyUnit, and were in some circles considered the preferred form. (In fact the first suggestion that one or the other should be deprecated, in 2008, is written by someone who was hoping to get rid of assert* and standardize on fail* :).) But I agree, these aliases should be deprecated in Twisted as well. -g
participants (3)
-
Adi Roiban
-
Craig Rodrigues
-
Glyph