diff --git a/Lib/test/test_tools.py b/Lib/test/test_tools.py --- a/Lib/test/test_tools.py +++ b/Lib/test/test_tools.py @@ -17,10 +17,11 @@ srcdir = sysconfig.get_config_var('projectbase') basepath = os.path.join(os.getcwd(), srcdir, 'Tools') +scriptsdir = os.path.join(basepath, 'scripts') class ReindentTests(unittest.TestCase): - script = os.path.join(basepath, 'scripts', 'reindent.py') + script = os.path.join(scriptsdir, 'reindent.py') def test_noargs(self): assert_python_ok(self.script) @@ -31,8 +32,21 @@ self.assertGreater(err, b'') +class TestSundry(unittest.TestCase): + # At least make sure the rest don't have syntax errors. When tests are + # added for a script it should be removed from this test. + + def test_sundry(self): + with support.DirsOnSysPath(scriptsdir): + print(os.listdir(scriptsdir)) + for fn in os.listdir(scriptsdir): + if fn.endswith('.py'): + __import__(fn[:-3]) + + def test_main(): - support.run_unittest(ReindentTests) + support.run_unittest(*[obj for obj in globals().values() + if isinstance(obj, type)]) if __name__ == '__main__': diff --git a/Tools/scripts/abitype.py b/Tools/scripts/abitype.py --- a/Tools/scripts/abitype.py +++ b/Tools/scripts/abitype.py @@ -79,7 +79,7 @@ while tokens[pos][0] in ('ws', 'comment'): pos += 1 if tokens[pos][1] != 'PyVarObject_HEAD_INIT': - raise Exception, '%s has no PyVarObject_HEAD_INIT' % name + raise Exception('%s has no PyVarObject_HEAD_INIT' % name) while tokens[pos][1] != ')': pos += 1 pos += 1