[Python-checkins] r85482 - in python/branches/py3k/Lib/test: regrtest.py support.py test_io.py test_tokenize.py

antoine.pitrou python-checkins at python.org
Thu Oct 14 17:34:31 CEST 2010


Author: antoine.pitrou
Date: Thu Oct 14 17:34:31 2010
New Revision: 85482

Log:
Replace the "compiler" resource with the more generic "cpu", so
as to mark CPU-heavy tests.



Modified:
   python/branches/py3k/Lib/test/regrtest.py
   python/branches/py3k/Lib/test/support.py
   python/branches/py3k/Lib/test/test_io.py
   python/branches/py3k/Lib/test/test_tokenize.py

Modified: python/branches/py3k/Lib/test/regrtest.py
==============================================================================
--- python/branches/py3k/Lib/test/regrtest.py	(original)
+++ python/branches/py3k/Lib/test/regrtest.py	Thu Oct 14 17:34:31 2010
@@ -138,8 +138,7 @@
     decimal -   Test the decimal module against a large suite that
                 verifies compliance with standards.
 
-    compiler -  Allow test_tokenize to verify round-trip lexing on
-                every file in the test library.
+    cpu -       Used for certain CPU-heavy tests.
 
     subprocess  Run all tests for the subprocess module.
 
@@ -214,7 +213,7 @@
 from test import support
 
 RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network',
-                  'decimal', 'compiler', 'subprocess', 'urlfetch', 'gui')
+                  'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui')
 
 TEMPDIR = os.path.abspath(tempfile.gettempdir())
 

Modified: python/branches/py3k/Lib/test/support.py
==============================================================================
--- python/branches/py3k/Lib/test/support.py	(original)
+++ python/branches/py3k/Lib/test/support.py	Thu Oct 14 17:34:31 2010
@@ -1046,7 +1046,7 @@
     return obj
 
 def requires_resource(resource):
-    if resource_is_enabled(resource):
+    if is_resource_enabled(resource):
         return _id
     else:
         return unittest.skip("resource {0!r} is not enabled".format(resource))

Modified: python/branches/py3k/Lib/test/test_io.py
==============================================================================
--- python/branches/py3k/Lib/test/test_io.py	(original)
+++ python/branches/py3k/Lib/test/test_io.py	Thu Oct 14 17:34:31 2010
@@ -837,6 +837,7 @@
         self.assertEquals(b"abcdefg", bufio.read())
 
     @unittest.skipUnless(threading, 'Threading required for this test.')
+    @support.requires_resource('cpu')
     def test_threads(self):
         try:
             # Write out many bytes with exactly the same number of 0's,
@@ -1105,6 +1106,7 @@
             self.assertEqual(f.read(), b"abc")
 
     @unittest.skipUnless(threading, 'Threading required for this test.')
+    @support.requires_resource('cpu')
     def test_threads(self):
         try:
             # Write out many bytes from many threads and test they were

Modified: python/branches/py3k/Lib/test/test_tokenize.py
==============================================================================
--- python/branches/py3k/Lib/test/test_tokenize.py	(original)
+++ python/branches/py3k/Lib/test/test_tokenize.py	Thu Oct 14 17:34:31 2010
@@ -514,13 +514,13 @@
     True
 
 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
     >>> tempdir = os.path.dirname(f) or os.curdir
     >>> 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)
     ...
     >>> for testfile in testfiles:


More information about the Python-checkins mailing list