diff options
author | Mark Dickinson <mdickinson@enthought.com> | 2012-06-23 08:27:47 (GMT) |
---|---|---|
committer | Mark Dickinson <mdickinson@enthought.com> | 2012-06-23 08:27:47 (GMT) |
commit | be4fb692010db30a0818748153dfa1f3c21eaa7c (patch) | |
tree | 40c7646e56334150139e0cfe5cf6201198fda8e6 | |
parent | dc00f1eba01fb51f655644c2900adb3fca3de1dd (diff) | |
download | cpython-be4fb692010db30a0818748153dfa1f3c21eaa7c.zip cpython-be4fb692010db30a0818748153dfa1f3c21eaa7c.tar.gz cpython-be4fb692010db30a0818748153dfa1f3c21eaa7c.tar.bz2 |
Issue #14742: test_unparse now only checks a limited number of files unless the 'cpu' resource is specified.
-rw-r--r-- | Lib/test/test_tools.py | 1 | ||||
-rw-r--r-- | Tools/parser/test_unparse.py | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_tools.py b/Lib/test/test_tools.py index cbe6d80..564b747 100644 --- a/Lib/test/test_tools.py +++ b/Lib/test/test_tools.py @@ -127,6 +127,7 @@ class Gprof2htmlTests(unittest.TestCase): # Run the tests in Tools/parser/test_unparse.py with support.DirsOnSysPath(os.path.join(basepath, 'parser')): from test_unparse import UnparseTestCase + from test_unparse import DirectoryTestCase def test_main(): diff --git a/Tools/parser/test_unparse.py b/Tools/parser/test_unparse.py index 647366c..be84400 100644 --- a/Tools/parser/test_unparse.py +++ b/Tools/parser/test_unparse.py @@ -2,9 +2,10 @@ import unittest import test.support import io import os +import random import tokenize -import ast import unparse +import ast def read_pyfile(filename): """Read and return the contents of a Python source file (as a @@ -257,6 +258,10 @@ class DirectoryTestCase(ASTTestCase): if n.endswith('.py') and not n.startswith('bad'): names.append(os.path.join(test_dir, n)) + # Test limited subset of files unless the 'cpu' resource is specified. + if not test.support.is_resource_enabled("cpu"): + names = random.sample(names, 10) + for filename in names: if test.support.verbose: print('Testing %s' % filename) |