diff options
author | Barry Warsaw <barry@python.org> | 2001-08-20 22:29:23 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2001-08-20 22:29:23 (GMT) |
commit | c0fb605ce3734e7d13301f9a232b12eaa09618ad (patch) | |
tree | 8fbcbb8cd3c1d8b98f64014ee32b999c00f4f2cf /Lib/test/test_support.py | |
parent | cfb167573680a052c0d4ddc22a5b904d03b0ecac (diff) | |
download | cpython-c0fb605ce3734e7d13301f9a232b12eaa09618ad.zip cpython-c0fb605ce3734e7d13301f9a232b12eaa09618ad.tar.gz cpython-c0fb605ce3734e7d13301f9a232b12eaa09618ad.tar.bz2 |
use_large_resources => use_resources
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.
Diffstat (limited to 'Lib/test/test_support.py')
-rw-r--r-- | Lib/test/test_support.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index 80b8356..8539997 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -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 |