Allow running of individual tests from cmdline.

This commit is contained in:
Emil Mikulic 2011-01-19 00:44:15 +11:00
parent d65990449e
commit b8bf9a0f72

View File

@ -102,6 +102,7 @@ def makeCase(name, url, hdr_checker=None, body_checker=None,
nerf("HTTP"+v),
{"\n":"LF", "\r\n":"CRLF"}[endl],
])
do_test.__name__ = test_name # hax
setattr(TestCases, test_name, do_test)
def makeCases(name, url, hdr_checker=None, body_checker=None,
@ -117,6 +118,7 @@ def makeSimpleCases(name, url, assert_name):
makeCases(name, url, None,
lambda self,body: getattr(self, assert_name)(body, url))
def setUpModule():
for args in [
["index", "/", "assertIsIndex"],
["up dir", "/dir/../", "assertIsIndex"],
@ -128,8 +130,8 @@ for args in [
]:
makeSimpleCases(*args)
if __name__ == '__main__':
setUpModule()
unittest.main()
#x = Conn().get("/xyz/../", "1.0")
#y = parse(x)