Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5bc4fa7

Browse files
committed
Replace the "compiler" resource with the more generic "cpu", so
as to mark CPU-heavy tests.
1 parent 3fbfea1 commit 5bc4fa7

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

Lib/test/regrtest.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@
138138
decimal - Test the decimal module against a large suite that
139139
verifies compliance with standards.
140140
141-
compiler - Allow test_tokenize to verify round-trip lexing on
142-
every file in the test library.
141+
cpu - Used for certain CPU-heavy tests.
143142
144143
subprocess Run all tests for the subprocess module.
145144
@@ -214,7 +213,7 @@
214213
from test import support
215214

216215
RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network',
217-
'decimal', 'compiler', 'subprocess', 'urlfetch', 'gui')
216+
'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui')
218217

219218
TEMPDIR = os.path.abspath(tempfile.gettempdir())
220219

Lib/test/support.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ def _id(obj):
10461046
return obj
10471047

10481048
def requires_resource(resource):
1049-
if resource_is_enabled(resource):
1049+
if is_resource_enabled(resource):
10501050
return _id
10511051
else:
10521052
return unittest.skip("resource {0!r} is not enabled".format(resource))

Lib/test/test_io.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,7 @@ def test_read_all(self):
837837
self.assertEquals(b"abcdefg", bufio.read())
838838

839839
@unittest.skipUnless(threading, 'Threading required for this test.')
840+
@support.requires_resource('cpu')
840841
def test_threads(self):
841842
try:
842843
# Write out many bytes with exactly the same number of 0's,
@@ -1105,6 +1106,7 @@ def test_truncate(self):
11051106
self.assertEqual(f.read(), b"abc")
11061107

11071108
@unittest.skipUnless(threading, 'Threading required for this test.')
1109+
@support.requires_resource('cpu')
11081110
def test_threads(self):
11091111
try:
11101112
# Write out many bytes from many threads and test they were

Lib/test/test_tokenize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,13 +514,13 @@
514514
True
515515
516516
Test roundtrip on random python modules.
517-
pass the '-ucompiler' option to process the full directory.
517+
pass the '-ucpu' option to process the full directory.
518518
519519
>>> import random
520520
>>> tempdir = os.path.dirname(f) or os.curdir
521521
>>> testfiles = glob.glob(os.path.join(tempdir, "test*.py"))
522522
523-
>>> if not support.is_resource_enabled("compiler"):
523+
>>> if not support.is_resource_enabled("cpu"):
524524
... testfiles = random.sample(testfiles, 10)
525525
...
526526
>>> for testfile in testfiles:

0 commit comments

Comments
 (0)