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

Patch by Martin Panter.
This commit is contained in:
Berker Peksag 2015-02-13 20:48:15 +02:00
parent a25c542c47
commit 366c570d1f
2 changed files with 18 additions and 1 deletions

View File

@ -82,7 +82,10 @@ XXX To do:
__version__ = "0.6"
__all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
__all__ = [
"HTTPServer", "BaseHTTPRequestHandler",
"SimpleHTTPRequestHandler", "CGIHTTPRequestHandler",
]
import html
import http.client

View File

@ -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)