Commit 366c570d authored by Berker Peksag's avatar Berker Peksag

Issue #23418: Add missing entries to http.server.__all__.

Patch by Martin Panter.
parent a25c542c
...@@ -82,7 +82,10 @@ XXX To do: ...@@ -82,7 +82,10 @@ XXX To do:
__version__ = "0.6" __version__ = "0.6"
__all__ = ["HTTPServer", "BaseHTTPRequestHandler"] __all__ = [
"HTTPServer", "BaseHTTPRequestHandler",
"SimpleHTTPRequestHandler", "CGIHTTPRequestHandler",
]
import html import html
import http.client import http.client
......
...@@ -760,6 +760,19 @@ class SimpleHTTPRequestHandlerTestCase(unittest.TestCase): ...@@ -760,6 +760,19 @@ class SimpleHTTPRequestHandlerTestCase(unittest.TestCase):
self.assertEqual(path, self.translated) 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): def test_main(verbose=None):
cwd = os.getcwd() cwd = os.getcwd()
try: try:
...@@ -769,6 +782,7 @@ def test_main(verbose=None): ...@@ -769,6 +782,7 @@ def test_main(verbose=None):
SimpleHTTPServerTestCase, SimpleHTTPServerTestCase,
CGIHTTPServerTestCase, CGIHTTPServerTestCase,
SimpleHTTPRequestHandlerTestCase, SimpleHTTPRequestHandlerTestCase,
MiscTestCase,
) )
finally: finally:
os.chdir(cwd) os.chdir(cwd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment