From 366c570d1f48df0f06707e34472b626bc97f03e3 Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Fri, 13 Feb 2015 20:48:15 +0200 Subject: [PATCH] Issue #23418: Add missing entries to http.server.__all__. Patch by Martin Panter. --- Lib/http/server.py | 5 ++++- Lib/test/test_httpservers.py | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Lib/http/server.py b/Lib/http/server.py index cfa29f44d35..a27890e6d9c 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -82,7 +82,10 @@ XXX To do: __version__ = "0.6" -__all__ = ["HTTPServer", "BaseHTTPRequestHandler"] +__all__ = [ + "HTTPServer", "BaseHTTPRequestHandler", + "SimpleHTTPRequestHandler", "CGIHTTPRequestHandler", +] import html import http.client diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index 569341d83b4..67a4654054e 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -760,6 +760,19 @@ class SimpleHTTPRequestHandlerTestCase(unittest.TestCase): self.assertEqual(path, self.translated) +class MiscTestCase(unittest.TestCase): + def test_all(self): + expected = [] + blacklist = {'executable', 'nobody_uid', 'test'} + for name in dir(server): + if name.startswith('_') or name in blacklist: + continue + module_object = getattr(server, name) + if getattr(module_object, '__module__', None) == 'http.server': + expected.append(name) + self.assertCountEqual(server.__all__, expected) + + def test_main(verbose=None): cwd = os.getcwd() try: @@ -769,6 +782,7 @@ def test_main(verbose=None): SimpleHTTPServerTestCase, CGIHTTPServerTestCase, SimpleHTTPRequestHandlerTestCase, + MiscTestCase, ) finally: os.chdir(cwd)