summaryrefslogtreecommitdiff
path: root/Tools/parser/test_unparse.py
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2012-06-23 09:27:47 +0100
committerMark Dickinson <mdickinson@enthought.com>2012-06-23 09:27:47 +0100
commitebdb3474041a71bbac3df71274078b3f23092802 (patch)
tree20e07b3f8ac2a18c6cba3e4de5bbc15a89bcccd6 /Tools/parser/test_unparse.py
parenta7a4b672aa8a21186f579d147a5537bf829b93f9 (diff)
downloadcpython-ebdb3474041a71bbac3df71274078b3f23092802.tar.gz
Issue #14742: test_unparse now only checks a limited number of files unless the 'cpu' resource is specified.
Diffstat (limited to 'Tools/parser/test_unparse.py')
-rw-r--r--Tools/parser/test_unparse.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Tools/parser/test_unparse.py b/Tools/parser/test_unparse.py
index 647366c93d..be84400c38 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)