jenkins-bot has submitted this change and it was merged.
Change subject: [DEPR] Deprecation warning for toStdout parameter in pywikibot.output
......................................................................
[DEPR] Deprecation warning for toStdout parameter in pywikibot.output
toStdout is maintained for backwards-compatibity only.
Show a deprecation warning.
tests added
Change-Id: Iacc2a0ac78f6a46537d0371d2256202dec4617d1
---
M pywikibot/logging.py
M tests/ui_tests.py
2 files changed, 12 insertions(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/logging.py b/pywikibot/logging.py
index 0577182..ab7b01c 100644
--- a/pywikibot/logging.py
+++ b/pywikibot/logging.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Logging functions."""
#
-# (C) Pywikibot team, 2010-2015
+# (C) Pywikibot team, 2010-2016
#
# Distributed under the terms of the MIT license.
#
@@ -131,9 +131,11 @@
Other keyword arguments are passed unchanged to the logger; so far, the
only argument that is useful is "exc_info=True", which causes the
log message to include an exception traceback.
-
"""
if toStdout: # maintained for backwards-compatibity only
+ from pywikibot.tools import issue_deprecation_warning # noqa
+ issue_deprecation_warning('"toStdout" parameter',
+ 'pywikibot.stdout()', 2)
logoutput(text, decoder, newline, STDOUT, **kwargs)
else:
logoutput(text, decoder, newline, INFO, **kwargs)
diff --git a/tests/ui_tests.py b/tests/ui_tests.py
index ce21c07..52485c2 100644
--- a/tests/ui_tests.py
+++ b/tests/ui_tests.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Tests for the user interface."""
#
-# (C) Pywikibot team, 2008-2015
+# (C) Pywikibot team, 2008-2016
#
# Distributed under the terms of the MIT license.
#
@@ -287,6 +287,13 @@
def test_output_stdout(self):
pywikibot.output('output', toStdout=True)
self.assertEqual(newstdout.getvalue(), 'output\n')
+ self.assertIn('DeprecationWarning: "toStdout" parameter is '
+ 'deprecated; use pywikibot.stdout() instead.\n',
+ newstderr.getvalue(),)
+
+ def test_stdout(self):
+ pywikibot.stdout('output')
+ self.assertEqual(newstdout.getvalue(), 'output\n')
self.assertEqual(newstderr.getvalue(), '')
def test_warning(self):
--
To view, visit
https://gerrit.wikimedia.org/r/273764
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iacc2a0ac78f6a46537d0371d2256202dec4617d1
Gerrit-PatchSet: 8
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Russell Blau <russblau(a)imapmail.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>