Commit 77b661a9 authored by Paul Ganssle's avatar Paul Ganssle

Add test for HTTPError in upload_file

parent 74177400
......@@ -3,6 +3,7 @@ import os
import re
from distutils import log
from distutils.errors import DistutilsError
from distutils.version import StrictVersion
import pytest
......@@ -146,3 +147,22 @@ class TestUploadTest:
with pytest.raises(AssertionError):
cmd.run()
def test_upload_file_http_error(self, patched_upload):
patched_upload.urlopen.side_effect = six.moves.urllib.error.HTTPError(
'https://example.com',
404,
'File not found',
None,
None
)
cmd = patched_upload.cmd
cmd.ensure_finalized()
with pytest.raises(DistutilsError):
cmd.run()
cmd.announce.assert_any_call(
'Upload failed (404): File not found',
log.ERROR)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment