我设置了 socketserver 来运行一些单元测试,并将其日志输出到控制台。
有没有办法禁用它?
这是我正在运行的大致代码:
class TestServer(SocketServer.TCPServer):
allow_reuse_address = True
class ScraperExampleTest(unittest.TestCase):
def setUp(self):
# Due to requests not supporting the 'file' scheme, we are forced to run
# our own server. See: https://github.com/kennethreitz/requests/issues/847
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = TestServer(('', PORT), Handler)
httpd_thread = threading.Thread(target=httpd.serve_forever)
httpd_thread.setDaemon(True)
httpd_thread.start()