Xqt created this task.
Xqt added a project: Pywikibot.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION
  Using contextlib.redirect_stderr or redirect_stdout does not work with 
pywikibot.output():
  
    >>> import contextlib
    >>> import io
    >>> import pywikibot
    >>> with contextlib.redirect_stderr(io.StringIO()) as f:
        pywikibot.output('foo')
    
        
    foo
    >>> s = f.getvalue()
    >>> s
    ''
    >>> with contextlib.redirect_stdout(io.StringIO()) as f:
        pywikibot.output('foo')
    
        
    foo
    >>> s = f.getvalue()
    >>> s
    ''
    >>> 
  
  but it works for Pythons help() function as expected:
  
    >>> with contextlib.redirect_stdout(io.StringIO()) as f:
        help('foo')
    
    >>> s = f.getvalue()
    >>> s
    "No Python documentation found for 'foo'.\nUse help() to get the 
interactive help utility.\nUse help(str) for help on the str class.\n\n"
    >>> 
  
  The behaviour fails in 6.2 as well as in a very early release 3.0.20180108

TASK DETAIL
  https://phabricator.wikimedia.org/T283808

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Xqt
Cc: valhallasw, Aklapper, Xqt, pywikibot-bugs-list, Shalomori123, Jyoo1011, 
JohnsonLee01, SHEKH, Dijkstra, Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS, 
Mdupont, JJMC89, Dvorapa, Altostratus, Avicennasis, mys_721tx, jayvdb, Masti, 
Alchimista
_______________________________________________
pywikibot-bugs mailing list -- pywikibot-bugs@lists.wikimedia.org
To unsubscribe send an email to pywikibot-bugs-le...@lists.wikimedia.org

Reply via email to