[Python-Dev] why is test_socketserver in expected skips? (original) (raw)

Guido van Rossum guido@python.org
Thu, 24 Apr 2003 10🔞26 -0400


testsocketserver seems to be in all the expected skip lists except for (oddly enough) os2emx.

Probably because the os2emx port hasn't been updated in a while.

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/testsocketserver.py the 2.3 branch version fails because the network resource isn't enabled: Traceback (most recent call last): File "../Lib/test/testsocketserver.py", line 5, in ? testsupport.requires('network') File "/Users/skip/src/python/head/dist/src/Lib/test/testsupport.py", line 68, in requires raise ResourceDenied(msg) test.testsupport.ResourceDenied: Use of the network' resource not enabled_ _[5953 refs]_ _Seems like a fairly simple change to testsupport.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().fback.fglobals.get("_name_") == "_main_":_ _return_ _if not isresourceenabled(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.

Looks good to me; I've thought of this myself occasionally. Please also update the README file for testing to mention this detail!

--Guido van Rossum (home page: http://www.python.org/~guido/)