summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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