This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author noam
Recipients Sergey.Kirpichev, georg.brandl, noam, noamraph, r.david.murray, tim.peters
Date 2021-04-26.10:28:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAO8o=D4euidTGfP4Dgii=WhsCzG5apX056iOFuG6ViE0rp_ZMg@mail.gmail.com>
In-reply-to <1619420917.74.0.675029688771.issue26092@roundup.psfhosted.org>
Content
Hi,

I think that using mock.patch to fix the problem is fine. I personally
haven't encountered this problem in the past years, so whatever you decide
is fine by me.

Thanks!
Noam

On Mon, Apr 26, 2021 at 10:08 AM Sergey B Kirpichev <report@bugs.python.org>
wrote:

>
> Sergey B Kirpichev <skirpichev@gmail.com> added the comment:
>
> Tim, lets decide on this simple issue.
>
> To me, https://bugs.python.org/issue8048 was obviously a bad thing.
> While it "fixes" one application, which customize sys.displayhook in a
> strange way - it break testing almost everyone, which do sys.displayhook
> customization.  See e.g.
> https://github.com/sympy/sympy/blob/master/conftest.py or
> https://github.com/diofant/diofant/blob/master/conftest.py.  BTW, SymPy
> is far more popular library than dreampie, which is py2-only and looks
> unmaintained.
>
> Last, but not least - introduced doctest's behaviour wasn't documented.
> It break things in a surprising way and do this silently...  There is a
> documentation issue if you decide to keep this "feature".
>
> Noam, what do you think about fixing your problem with mock.patch?
>
>     >>> import sys
>     >>> from unittest.mock import patch
>     >>> with patch('sys.displayhook', sys.__displayhook__):
>     ...     doctest.testmod()
>
> Tentative patch attached.
>
> ----------
> keywords: +patch
> Added file: https://bugs.python.org/file49985/doctest-displayhook.diff
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue26092>
> _______________________________________
>
History
Date User Action Args
2021-04-26 10:28:35noamsetrecipients: + noam, tim.peters, georg.brandl, r.david.murray, Sergey.Kirpichev, noamraph
2021-04-26 10:28:35noamlinkissue26092 messages
2021-04-26 10:28:35noamcreate