From b44537d279a8d5e49c2f67f08840b6dee120e695 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 20 Jun 2012 15:21:47 +0100 Subject: Handle only the urllib2.URLError exceptions Handling all exceptions in a way that assumes they're all related to the URL fetching hides unrelated errors, such as missing imports, or bad types, or such. Also, add more logging for debugging. --- morphlib/remoteartifactcache_tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'morphlib/remoteartifactcache_tests.py') diff --git a/morphlib/remoteartifactcache_tests.py b/morphlib/remoteartifactcache_tests.py index b7f10450..201cfc50 100644 --- a/morphlib/remoteartifactcache_tests.py +++ b/morphlib/remoteartifactcache_tests.py @@ -16,6 +16,7 @@ import StringIO import unittest +import urllib2 import morphlib @@ -76,7 +77,7 @@ class RemoteArtifactCacheTests(unittest.TestCase): if filename in self.existing_files: return StringIO.StringIO('%s' % filename) else: - raise Exception('foo') + raise urllib2.URLError('foo') def test_sets_server_url(self): self.assertEqual(self.cache.server_url, self.server_url) -- cgit v1.2.1