← Back to team overview

apport-hackers team mailing list archive

[Merge] lp:~brian-murray/apport/test-fix into lp:apport


Brian Murray has proposed merging lp:~brian-murray/apport/test-fix into lp:apport.

Requested reviews:
  Apport upstream developers (apport-hackers)

For more details, see:

Fix this:

There is one failure left with Python 2:                                                                                                      
ERROR: test_use_sources_for_a_ppa (__main__.T)                                                                                                
Use a sources.list.d file for a PPA.                                                                                                          
Traceback (most recent call last):                                                                                                            
  File "test/test_backend_apt_dpkg.py", line 1028, in test_use_sources_for_a_ppa                                                              
    'ubuntu', 'trusty', origins=['LP-PPA-%s' % ppa])                                                                                          
  File "backends/packaging-apt-dpkg.py", line 1372, in _build_apt_sandbox                                                                     
    ppa_info = apport.packaging.json_request(ppa_archive_url)                                                                                 
  File "/home/martin/ubuntu/apport/trunk/apport/packaging_impl.py", line 282, in json_request                                                 
    return json.loads(content)                                                                                                                
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads                                                                              
    return _default_decoder.decode(s)                                                                                                         
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode                                                                              
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())                                                                                         
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode                                                                          
    raise ValueError("No JSON object could be decoded")                                                                                       
ValueError: No JSON object could be decoded           
Your team Apport upstream developers is requested to review the proposed merge of lp:~brian-murray/apport/test-fix into lp:apport.
=== modified file 'backends/packaging-apt-dpkg.py'
--- backends/packaging-apt-dpkg.py	2015-07-15 04:51:20 +0000
+++ backends/packaging-apt-dpkg.py	2015-07-15 18:44:14 +0000
@@ -266,13 +266,15 @@
             response = urlopen(url)
-        except URLError:
-            apport.warning('cannot connect to: %s' % url)
+            if response.getcode() >= 400:
+                raise HTTPError('%u' % response.getcode())
+        except (URLError, HTTPError):
+            apport.warning('cannot connect to: %s' % unquote(url))
             return None
             content = response.read()
         except IOError:
-            apport.warning('failure reading data at: %s' % url)
+            apport.warning('failure reading data at: %s' % unquote(url))
             return None
         if isinstance(content, bytes):
             content = content.decode('utf-8')

Follow ups