]> granicus.if.org Git - python/commitdiff
use_large_resources => use_resources
authorBarry Warsaw <barry@python.org>
Mon, 20 Aug 2001 22:29:23 +0000 (22:29 +0000)
committerBarry Warsaw <barry@python.org>
Mon, 20 Aug 2001 22:29:23 +0000 (22:29 +0000)
requires(): New function which can be used to `assert' that a specific
    -u/--use resource flag is present.  Raises a TestSkipped if not.
    This is used in test_largefile and test_socket_ssl to enable
    external or resource consumptive tests that are normally
    disabled.

Lib/test/test_support.py

index 80b83562a73e79bb53d6106b4268ff9b5ba4c3fc..85399973d7495ccd365119dde64d65a068f99137 100644 (file)
@@ -19,8 +19,8 @@ class TestSkipped(Error):
     TestFailed.
     """
 
-verbose = 1                             # Flag set to 0 by regrtest.py
-use_large_resources = 1 # Flag set to 0 by regrtest.py
+verbose = 1              # Flag set to 0 by regrtest.py
+use_resources = []       # Flag set to [] by regrtest.py
 
 def unload(name):
     try:
@@ -37,6 +37,12 @@ def forget(modname):
         except os.error:
             pass
 
+def requires(resource, msg=None):
+    if resource not in use_resources:
+        if msg is None:
+            msg = "Use of the `%s' resource not enabled" % resource
+        raise TestSkipped(msg)
+
 FUZZ = 1e-6
 
 def fcmp(x, y): # fuzzy comparison function