diff --git a/dvc/exceptions.py b/dvc/exceptions.py index 3ad8c72b8..62c0a3466 100644 --- a/dvc/exceptions.py +++ b/dvc/exceptions.py @@ -352,6 +352,4 @@ class NoOutputInExternalRepoError(DvcException): class HTTPError(DvcException): def __init__(self, code, reason): - super(HTTPError, self).__init__( - "HTTP error: '{} {}'".format(code, reason) - ) + super(HTTPError, self).__init__("'{} {}'".format(code, reason)) diff --git a/dvc/remote/http.py b/dvc/remote/http.py index e9ec4f888..bf7e93adb 100644 --- a/dvc/remote/http.py +++ b/dvc/remote/http.py @@ -50,7 +50,6 @@ class RemoteHTTP(RemoteBASE): with open(to_file, "wb") as fd: for chunk in response.iter_content(chunk_size=self.CHUNK_SIZE): fd.write(chunk) - fd.flush() pbar.update(len(chunk)) def exists(self, path_info): diff --git a/tests/unit/remote/test_http.py b/tests/unit/remote/test_http.py index 924a05ae2..c0d3bd42b 100644 --- a/tests/unit/remote/test_http.py +++ b/tests/unit/remote/test_http.py @@ -1,8 +1,3 @@ -try: - from http.server import BaseHTTPRequestHandler -except ImportError: - from BaseHTTPServer import BaseHTTPRequestHandler - import pytest from dvc.config import ConfigError @@ -24,12 +19,7 @@ def test_no_traverse_compatibility(dvc_repo): def test_download_fails_on_error_code(dvc_repo): - class ErrorStatusRequestHandler(BaseHTTPRequestHandler): - def do_GET(self): - self.send_response(404, message="Not found") - self.end_headers() - - with StaticFileServer(ErrorStatusRequestHandler) as httpd: + with StaticFileServer() as httpd: url = "http://localhost:{}/".format(httpd.server_port) config = {"url": url}