diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/socketserver.py | 8 | ||||
-rw-r--r-- | Lib/test/test_socketserver.py | 19 |
2 files changed, 16 insertions, 11 deletions
diff --git a/Lib/socketserver.py b/Lib/socketserver.py index 7339911..5cb89be 100644 --- a/Lib/socketserver.py +++ b/Lib/socketserver.py @@ -138,10 +138,10 @@ try: except ImportError: import dummy_threading as threading -__all__ = ["TCPServer","UDPServer","ForkingUDPServer","ForkingTCPServer", - "ThreadingUDPServer","ThreadingTCPServer","BaseRequestHandler", - "StreamRequestHandler","DatagramRequestHandler", - "ThreadingMixIn", "ForkingMixIn"] +__all__ = ["BaseServer", "TCPServer", "UDPServer", "ForkingUDPServer", + "ForkingTCPServer", "ThreadingUDPServer", "ThreadingTCPServer", + "BaseRequestHandler", "StreamRequestHandler", + "DatagramRequestHandler", "ThreadingMixIn", "ForkingMixIn"] if hasattr(socket, "AF_UNIX"): __all__.extend(["UnixStreamServer","UnixDatagramServer", "ThreadingUnixStreamServer", diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py index 0276f99..924b9c4 100644 --- a/Lib/test/test_socketserver.py +++ b/Lib/test/test_socketserver.py @@ -2,7 +2,6 @@ Test suite for socketserver. """ -import _imp as imp import contextlib import os import select @@ -313,12 +312,18 @@ class SocketServerTest(unittest.TestCase): socketserver.StreamRequestHandler) -def test_main(): - if imp.lock_held(): - # If the import lock is held, the threads will hang - raise unittest.SkipTest("can't run when import lock is held") +class MiscTestCase(unittest.TestCase): + + def test_all(self): + # objects defined in the module should be in __all__ + expected = [] + for name in dir(socketserver): + if not name.startswith('_'): + mod_object = getattr(socketserver, name) + if getattr(mod_object, '__module__', None) == 'socketserver': + expected.append(name) + self.assertCountEqual(socketserver.__all__, expected) - test.support.run_unittest(SocketServerTest) if __name__ == "__main__": - test_main() + unittest.main() |