mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-12 17:31:29 +00:00
Actually, now that more things expect streaming bytes over the wire
the mirror tests don't stall anymore. Also use a codec.reader to slurp up unicode bytes for json.load.
This commit is contained in:
parent
5da114b070
commit
866adfd768
@ -48,6 +48,7 @@ if sys.version_info[0] >= 3:
|
|||||||
from debian.changelog import Changelog, Version
|
from debian.changelog import Changelog, Version
|
||||||
import debian.deb822
|
import debian.deb822
|
||||||
import debian.debian_support
|
import debian.debian_support
|
||||||
|
import codecs
|
||||||
import httplib2
|
import httplib2
|
||||||
|
|
||||||
from ubuntutools.config import UDTConfig
|
from ubuntutools.config import UDTConfig
|
||||||
@ -508,10 +509,13 @@ class DebianSourcePackage(SourcePackage):
|
|||||||
"python-simplejson")
|
"python-simplejson")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
srcfiles = json.load(self.url_opener.open(
|
data = self.url_opener.open(
|
||||||
'http://snapshot.debian.org'
|
'http://snapshot.debian.org'
|
||||||
'/mr/package/%s/%s/srcfiles?fileinfo=1'
|
'/mr/package/%s/%s/srcfiles?fileinfo=1'
|
||||||
% (self.source, self.version.full_version)))
|
% (self.source, self.version.full_version))
|
||||||
|
reader = codecs.getreader('utf-8')
|
||||||
|
srcfiles = json.load(reader(data))
|
||||||
|
|
||||||
except HTTPError:
|
except HTTPError:
|
||||||
Logger.error('Version %s of %s not found on '
|
Logger.error('Version %s of %s not found on '
|
||||||
'snapshot.debian.org',
|
'snapshot.debian.org',
|
||||||
|
@ -226,7 +226,6 @@ class LocalSourcePackageTestCase(unittest.TestCase):
|
|||||||
pkg.quiet = True
|
pkg.quiet = True
|
||||||
pkg.pull()
|
pkg.pull()
|
||||||
|
|
||||||
@unittest.skipIf(sys.version_info[0] >=3, "Stalls on PY3")
|
|
||||||
def test_mirrors(self):
|
def test_mirrors(self):
|
||||||
master = UDTConfig.defaults['UBUNTU_MIRROR']
|
master = UDTConfig.defaults['UBUNTU_MIRROR']
|
||||||
mirror = 'http://mirror'
|
mirror = 'http://mirror'
|
||||||
@ -256,7 +255,6 @@ class LocalSourcePackageTestCase(unittest.TestCase):
|
|||||||
class DebianLocalSourcePackageTestCase(LocalSourcePackageTestCase):
|
class DebianLocalSourcePackageTestCase(LocalSourcePackageTestCase):
|
||||||
SourcePackage = ubuntutools.archive.DebianSourcePackage
|
SourcePackage = ubuntutools.archive.DebianSourcePackage
|
||||||
|
|
||||||
@unittest.skipIf(sys.version_info[0] >=3, "Stalls on PY3")
|
|
||||||
def test_mirrors(self):
|
def test_mirrors(self):
|
||||||
debian_master = UDTConfig.defaults['DEBIAN_MIRROR']
|
debian_master = UDTConfig.defaults['DEBIAN_MIRROR']
|
||||||
debsec_master = UDTConfig.defaults['DEBSEC_MIRROR']
|
debsec_master = UDTConfig.defaults['DEBSEC_MIRROR']
|
||||||
@ -271,7 +269,7 @@ class DebianLocalSourcePackageTestCase(LocalSourcePackageTestCase):
|
|||||||
self.urlopen_404,
|
self.urlopen_404,
|
||||||
self.urlopen_404,
|
self.urlopen_404,
|
||||||
lambda x: BytesIO(
|
lambda x: BytesIO(
|
||||||
'{"fileinfo": {"hashabc": [{"name": "example_1.0.orig.tar.gz"}]}}'),
|
b'{"fileinfo": {"hashabc": [{"name": "example_1.0.orig.tar.gz"}]}}'),
|
||||||
self.urlopen_file('example_1.0.orig.tar.gz'),
|
self.urlopen_file('example_1.0.orig.tar.gz'),
|
||||||
self.urlopen_proxy]
|
self.urlopen_proxy]
|
||||||
def _callable_iter(*args, **kwargs):
|
def _callable_iter(*args, **kwargs):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user