summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2003-04-24 19:06:57 (GMT)
committerSkip Montanaro <skip@pobox.com>2003-04-24 19:06:57 (GMT)
commitd839ecdc8133c34c024deb8474b7d4788c38b85c (patch)
tree90afadc66c61663ed73b1d743ca5b41558f865bd /Lib
parent142da98beb881e763c836893c9c3f1bebf32daec (diff)
downloadcpython-d839ecdc8133c34c024deb8474b7d4788c38b85c.zip
cpython-d839ecdc8133c34c024deb8474b7d4788c38b85c.tar.gz
cpython-d839ecdc8133c34c024deb8474b7d4788c38b85c.tar.bz2
if the test is run directly (__name__ == "__main__") don't actually require
particular resources
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_support.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 776341d..c61e194 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -62,6 +62,10 @@ def is_resource_enabled(resource):
return use_resources is not None and resource in use_resources
def requires(resource, msg=None):
+ # see if the caller's module is __main__ - if so, treat as if
+ # the resource was set
+ if sys._getframe().f_back.f_globals.get("__name__") == "__main__":
+ return
if not is_resource_enabled(resource):
if msg is None:
msg = "Use of the `%s' resource not enabled" % resource