Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Merged PR 1192: Fixing WebDependency urllib.request error on Linux
Browse files Browse the repository at this point in the history
With just `import urllib`, the modules inside urllib were not imported.
We will now be importing urllib.request and urllib.error directly so they can be used consistently.
  • Loading branch information
Max Knutsen committed May 22, 2019
1 parent 47b9c9d commit 211526a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion MuEnvironment/WebDependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
import shutil
import tarfile
import zipfile
import urllib
import urllib.error
import urllib.request
from MuEnvironment.ExternalDependency import ExternalDependency


Expand Down
3 changes: 2 additions & 1 deletion MuEnvironment/tests/test_WebDependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import tarfile
import zipfile
import tempfile
import urllib.request
from MuEnvironment import EnvironmentDescriptorFiles as EDF
from MuEnvironment.WebDependency import WebDependency

Expand Down Expand Up @@ -94,7 +95,7 @@ def test_fail_with_bad_url(self):

ext_dep_descriptor = EDF.ExternDepDescriptor(ext_dep_file_path).descriptor_contents
ext_dep = WebDependency(ext_dep_descriptor)
with self.assertRaises(Exception):
with self.assertRaises(urllib.error.HTTPError):
ext_dep.fetch()
self.fail("should have thrown an Exception")

Expand Down

0 comments on commit 211526a

Please sign in to comment.