Merge lp:~brian-murray/apport/test-fix into lp:~apport-hackers/apport/trunk

Proposed by Brian Murray
Status: Merged
Merged at revision: 2981
Proposed branch: lp:~brian-murray/apport/test-fix
Merge into: lp:~apport-hackers/apport/trunk
Diff against target: 22 lines (+5/-3)
1 file modified
backends/packaging-apt-dpkg.py (+5/-3)
To merge this branch: bzr merge lp:~brian-murray/apport/test-fix
Reviewer Review Type Date Requested Status
Martin Pitt (community) Approve
Review via email: mp+264901@code.launchpad.net

Description of the change

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

To post a comment you must log in.
Revision history for this message
Martin Pitt (pitti) wrote :

Ah, I was grepping for HTTPError only, so I missed that spot. Pulled. Thanks Brian!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'backends/packaging-apt-dpkg.py'
2--- backends/packaging-apt-dpkg.py 2015-07-15 04:51:20 +0000
3+++ backends/packaging-apt-dpkg.py 2015-07-15 18:44:14 +0000
4@@ -266,13 +266,15 @@
5 '''
6 try:
7 response = urlopen(url)
8- except URLError:
9- apport.warning('cannot connect to: %s' % url)
10+ if response.getcode() >= 400:
11+ raise HTTPError('%u' % response.getcode())
12+ except (URLError, HTTPError):
13+ apport.warning('cannot connect to: %s' % unquote(url))
14 return None
15 try:
16 content = response.read()
17 except IOError:
18- apport.warning('failure reading data at: %s' % url)
19+ apport.warning('failure reading data at: %s' % unquote(url))
20 return None
21 if isinstance(content, bytes):
22 content = content.decode('utf-8')

Subscribers

People subscribed via source and target branches