A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-April/034973.html below:

[Python-Dev] why is test_socketserver in expected skips?

[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



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4