diff -r 9beeb4c1375d Lib/optparse.py --- a/Lib/optparse.py Sat Oct 31 13:07:44 2015 -0700 +++ b/Lib/optparse.py Sun Nov 01 15:24:51 2015 -0500 @@ -74,6 +74,11 @@ import sys, os import textwrap +import warnings + +warnings.warn("The optparse module is deprecated and will not be developed " + "further; development will continue with the argparse module.", + PendingDeprecationWarning, stacklevel=2) def _repr(self): return "<%s at 0x%x: %s>" % (self.__class__.__name__, id(self), self) diff -r 9beeb4c1375d Lib/test/test_optparse.py --- a/Lib/test/test_optparse.py Sat Oct 31 13:07:44 2015 -0700 +++ b/Lib/test/test_optparse.py Sun Nov 01 15:24:51 2015 -0500 @@ -16,12 +16,15 @@ from test import support -from optparse import make_option, Option, \ - TitledHelpFormatter, OptionParser, OptionGroup, \ - SUPPRESS_USAGE, OptionError, OptionConflictError, \ - BadOptionError, OptionValueError, Values -from optparse import _match_abbrev -from optparse import _parse_num +import warnings +with warnings.catch_warnings(): + warnings.simplefilter('ignore', PendingDeprecationWarning) + from optparse import make_option, Option, \ + TitledHelpFormatter, OptionParser, OptionGroup, \ + SUPPRESS_USAGE, OptionError, OptionConflictError, \ + BadOptionError, OptionValueError, Values + from optparse import _match_abbrev + from optparse import _parse_num retype = type(re.compile(''))