[Python-Dev] why is test_socketserver in expected skips?
Skip Montanaro
skip@pobox.com
Thu, 24 Apr 2003 09:10:17 -0500
test_socketserver seems to be in all the expected skip lists except for
(oddly enough) os2emx. It correctly bails if the network resource isn't set
and the 2.2 branch version seems to complete for me on my Mac OS X system.
When run like:
% ./python.exe ../Lib/test/test_socketserver.py
the 2.3 branch version fails because the network resource isn't enabled:
Traceback (most recent call last):
File "../Lib/test/test_socketserver.py", line 5, in ?
test_support.requires('network')
File "/Users/skip/src/python/head/dist/src/Lib/test/test_support.py", line 68, in requires
raise ResourceDenied(msg)
test.test_support.ResourceDenied: Use of the `network' resource not enabled
[5953 refs]
Seems like a fairly simple change to test_support.requires() would correct
things:
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
raise ResourceDenied(msg)
Someone please shout if the above not-quite-obvious code doesn't look
correct.
Thx,
Skip