📄 pytorture
字号:
#!/usr/bin/pythonimport sysfrom optparse import OptionParser# Parse command lineparser = OptionParser()parser.add_option("-b", "--binding", action="store", type="string", dest="binding")parser.add_option("-d", "--domain", action="store", type="string", dest="domain")parser.add_option("-u", "--username", action="store", type="string", dest="username")parser.add_option("-p", "--password", action="store", type="string", dest="password")(options, args) = parser.parse_args()if not options.binding: parser.error('You must supply a binding string')if not options.username or not options.password or not options.domain: parser.error('You must supply a domain, username and password')binding = options.bindingdomain = options.domainusername = options.usernamepassword = options.passwordif len(args) == 0: parser.error('You must supply the name of a module to test')# Import and testfor test in args: try: module = __import__('torture_%s' % test) except ImportError: print 'No such module "%s"' % test sys.exit(1) if not hasattr(module, 'runtests'): print 'Module "%s" does not have a runtests function' % test module.runtests(binding, (domain, username, password))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -