Commit d839ecdc authored by Skip Montanaro's avatar Skip Montanaro

if the test is run directly (__name__ == "__main__") don't actually require

particular resources
parent 142da98b
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment