我正在单元测试一个URLgetter,我需要一个总是导致urllib2.urlopen()(Python)超时的测试url。我试过制作一个只有sleep(10000)的php页面,但这会导致500内部服务器错误。我如何制作一个资源,无论何时请求它都会导致客户端连接超时? 最佳答案 Edit:Isawthe[php]tagandjustassumedthiswasPHPcode--however,thesameprinciplescanapplyinPythonifthat'sthelanguageyou'reworkingwith.