def test_fetch_to_files_with_non_existing_directory(self):
"""
The deferred list returned by L{fetch_to_files} results in a failure
if the destination directory doesn't exist.
"""
url_results = {"http://im/right": b"right"}
directory = "i/dont/exist/"
curl = CurlManyStub(url_results)
result = fetch_to_files(url_results.keys(), directory, curl=curl)
def check_error(failure):
error = str(failure.value.subFailure.value)
self.assertEqual(error,
("[Errno 2] No such file or directory: "
"'i/dont/exist/right'"))
self.assertFalse(os.path.exists(os.path.join(directory, "right")))
result.addErrback(check_error)
return result
评论列表
文章目录