mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Replace the "compiler" resource with the more generic "cpu", so
as to mark CPU-heavy tests.
This commit is contained in:
parent
3fbfea1fae
commit
5bc4fa7a49
4 changed files with 7 additions and 6 deletions
|
|
@ -138,8 +138,7 @@ resources to test. Currently only the following are defined:
|
||||||
decimal - Test the decimal module against a large suite that
|
decimal - Test the decimal module against a large suite that
|
||||||
verifies compliance with standards.
|
verifies compliance with standards.
|
||||||
|
|
||||||
compiler - Allow test_tokenize to verify round-trip lexing on
|
cpu - Used for certain CPU-heavy tests.
|
||||||
every file in the test library.
|
|
||||||
|
|
||||||
subprocess Run all tests for the subprocess module.
|
subprocess Run all tests for the subprocess module.
|
||||||
|
|
||||||
|
|
@ -214,7 +213,7 @@ INTERRUPTED = -4
|
||||||
from test import support
|
from test import support
|
||||||
|
|
||||||
RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network',
|
RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network',
|
||||||
'decimal', 'compiler', 'subprocess', 'urlfetch', 'gui')
|
'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui')
|
||||||
|
|
||||||
TEMPDIR = os.path.abspath(tempfile.gettempdir())
|
TEMPDIR = os.path.abspath(tempfile.gettempdir())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1046,7 +1046,7 @@ def _id(obj):
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
def requires_resource(resource):
|
def requires_resource(resource):
|
||||||
if resource_is_enabled(resource):
|
if is_resource_enabled(resource):
|
||||||
return _id
|
return _id
|
||||||
else:
|
else:
|
||||||
return unittest.skip("resource {0!r} is not enabled".format(resource))
|
return unittest.skip("resource {0!r} is not enabled".format(resource))
|
||||||
|
|
|
||||||
|
|
@ -837,6 +837,7 @@ class BufferedReaderTest(unittest.TestCase, CommonBufferedTests):
|
||||||
self.assertEquals(b"abcdefg", bufio.read())
|
self.assertEquals(b"abcdefg", bufio.read())
|
||||||
|
|
||||||
@unittest.skipUnless(threading, 'Threading required for this test.')
|
@unittest.skipUnless(threading, 'Threading required for this test.')
|
||||||
|
@support.requires_resource('cpu')
|
||||||
def test_threads(self):
|
def test_threads(self):
|
||||||
try:
|
try:
|
||||||
# Write out many bytes with exactly the same number of 0's,
|
# Write out many bytes with exactly the same number of 0's,
|
||||||
|
|
@ -1105,6 +1106,7 @@ class BufferedWriterTest(unittest.TestCase, CommonBufferedTests):
|
||||||
self.assertEqual(f.read(), b"abc")
|
self.assertEqual(f.read(), b"abc")
|
||||||
|
|
||||||
@unittest.skipUnless(threading, 'Threading required for this test.')
|
@unittest.skipUnless(threading, 'Threading required for this test.')
|
||||||
|
@support.requires_resource('cpu')
|
||||||
def test_threads(self):
|
def test_threads(self):
|
||||||
try:
|
try:
|
||||||
# Write out many bytes from many threads and test they were
|
# Write out many bytes from many threads and test they were
|
||||||
|
|
|
||||||
|
|
@ -514,13 +514,13 @@ Two string literals on the same line
|
||||||
True
|
True
|
||||||
|
|
||||||
Test roundtrip on random python modules.
|
Test roundtrip on random python modules.
|
||||||
pass the '-ucompiler' option to process the full directory.
|
pass the '-ucpu' option to process the full directory.
|
||||||
|
|
||||||
>>> import random
|
>>> import random
|
||||||
>>> tempdir = os.path.dirname(f) or os.curdir
|
>>> tempdir = os.path.dirname(f) or os.curdir
|
||||||
>>> testfiles = glob.glob(os.path.join(tempdir, "test*.py"))
|
>>> testfiles = glob.glob(os.path.join(tempdir, "test*.py"))
|
||||||
|
|
||||||
>>> if not support.is_resource_enabled("compiler"):
|
>>> if not support.is_resource_enabled("cpu"):
|
||||||
... testfiles = random.sample(testfiles, 10)
|
... testfiles = random.sample(testfiles, 10)
|
||||||
...
|
...
|
||||||
>>> for testfile in testfiles:
|
>>> for testfile in testfiles:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue