From 5cbdccfb81f3670eb86a79a700854cec905def6a Mon Sep 17 00:00:00 2001 From: Jonathan Perret Date: Wed, 13 Jul 2016 12:21:51 +0200 Subject: [PATCH] Do not force DeprecationWarning to be displayed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change removes a `warnings.simplefilter` call that forced `DeprecationWarning` occurrences (whether they are generated by this library or any other code) to be displayed to the user. This call caused Jenkins Job Builder, for example, to display several developer-targeted warnings that are not helpful to the final user. According to the Python documentation: > Warnings that are only of interest to the developer are ignored by > default. […] Having certain warnings ignored by default is done to > prevent a user from seeing warnings that are only of interest to the > developer. […] While you as a developer want to be notified that your > code is using a deprecated module, to a user this information is > essentially noise and provides no benefit to them. (https://docs.python.org/2/library/warnings.html#updating-code-for-new-versions-of-python) Change-Id: I31d4c6bd494361aa153fd59e2ceb6bedccd280bc --- jenkins/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/jenkins/__init__.py b/jenkins/__init__.py index 4191f00..2cabd3c 100755 --- a/jenkins/__init__.py +++ b/jenkins/__init__.py @@ -74,7 +74,6 @@ try: except ImportError: pass -warnings.simplefilter("default", DeprecationWarning) if sys.version_info < (2, 7, 0): warnings.warn("Support for python 2.6 is deprecated and will be removed.")