From adfb02cfbbd3205b5f86a475ac4f9080337eb1c5 Mon Sep 17 00:00:00 2001 From: "steven.bethard" Date: Sat, 12 Sep 2009 16:48:40 +0000 Subject: Silence Python 2.6 buggy warnings about Exception.message. --- argparse.py | 9 +++++++++ test/test_argparse.py | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/argparse.py b/argparse.py index 1996f46..0f407e7 100644 --- a/argparse.py +++ b/argparse.py @@ -118,6 +118,15 @@ except NameError: result.reverse() return result +# silence Python 2.6 buggy warnings about Exception.message +if _sys.version_info[:2] == (2, 6): + import warnings + warnings.filterwarnings( + action='ignore', + message='BaseException.message has been deprecated as of Python 2.6', + category=DeprecationWarning, + module='argparse') + SUPPRESS = '==SUPPRESS==' diff --git a/test/test_argparse.py b/test/test_argparse.py index ad2be1a..6939380 100644 --- a/test/test_argparse.py +++ b/test/test_argparse.py @@ -44,6 +44,14 @@ except NameError: result.reverse() return result +# silence Python 2.6 buggy warnings about Exception.message +if sys.version_info[:2] == (2, 6): + import warnings + warnings.filterwarnings( + action='ignore', + message='BaseException.message has been deprecated as of Python 2.6', + category=DeprecationWarning) + class TestCase(unittest.TestCase): -- cgit v1.2.1