[Twisted-Python] failUnlessFailure vs assertFailure

Craig Rodrigues rodrigc at crodrigues.org
Wed Jan 3 14:19:09 MST 2018


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 at 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 at twistedmatrix.com
> https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20180103/8071ed3e/attachment-0002.html>


More information about the Twisted-Python mailing list