diff -r a75b88048339 Lib/test/regrtest.py --- a/Lib/test/regrtest.py Thu Nov 14 16:16:29 2013 -0800 +++ b/Lib/test/regrtest.py Thu Nov 14 23:17:52 2013 -0600 @@ -322,6 +322,8 @@ group.add_argument('-F', '--forever', action='store_true', help='run the specified tests in a loop, until an ' 'error happens') + group.add_argument('--failnoimpl', action='store_true', + help='count tests with no implementation as failures') parser.add_argument('args', nargs=argparse.REMAINDER, help=argparse.SUPPRESS) @@ -361,7 +363,7 @@ findleaks=False, use_resources=None, trace=False, coverdir='coverage', runleaks=False, huntrleaks=False, verbose2=False, print_slow=False, random_seed=None, use_mp=None, verbose3=False, forever=False, - header=False, failfast=False, match_tests=None) + header=False, failfast=False, match_tests=None, failnoimpl=False) for k, v in kwargs.items(): if not hasattr(ns, k): raise TypeError('%r is an invalid keyword argument ' @@ -639,6 +641,7 @@ test_times = [] support.verbose = ns.verbose # Tell tests to be moderately quiet support.use_resources = ns.use_resources + support.failnoimpl = ns.failnoimpl save_modules = sys.modules.keys() def accumulate_result(test, result): diff -r a75b88048339 Lib/test/support/__init__.py --- a/Lib/test/support/__init__.py Thu Nov 14 16:16:29 2013 -0800 +++ b/Lib/test/support/__init__.py Thu Nov 14 23:17:52 2013 -0600 @@ -85,7 +85,7 @@ "skip_unless_symlink", "requires_gzip", "requires_bz2", "requires_lzma", "bigmemtest", "bigaddrspacetest", "cpython_only", "get_attribute", "requires_IEEE_754", "skip_unless_xattr", "requires_zlib", - "anticipate_failure", + "anticipate_failure", "not_implemented", # sys "is_jython", "check_impl_detail", # network @@ -2134,3 +2134,24 @@ # actually override the attribute setattr(object_to_patch, attr_name, new_value) + + +failnoimpl = True # by default, fail if a test is not implemented + # and the test file is run directly. + # regrtest changes this to False by default + +def not_implemented(func): + """Decorator for use on tests which are not yet implemented. + + When run in verbose mode, tests with this decorator will stand out a bit + in the test listing due to the docstring and the expected failure. + """ + + @functools.wraps(func) + def test(self): + raise NotImplementedError('Test needs to be implemented') + test.__doc__ = "Not implemented: {}".format(test.__qualname__) + + if failnoimpl: + return test + return unittest.expectedFailure(test) diff -r a75b88048339 Lib/test/test_minidom.py --- a/Lib/test/test_minidom.py Thu Nov 14 16:16:29 2013 -0800 +++ b/Lib/test/test_minidom.py Thu Nov 14 23:17:52 2013 -0600 @@ -1,7 +1,7 @@ # test for xml.dom.minidom import pickle -from test.support import run_unittest, findfile +from test.support import run_unittest, findfile, not_implemented import unittest import xml.dom.minidom @@ -360,12 +360,15 @@ and el.getAttribute("spam2") == "bam2") dom.unlink() + @not_implemented def testGetAttrList(self): pass + @not_implemented def testGetAttrValues(self): pass + @not_implemented def testGetAttrLength(self): pass