[Merge] lp:~fginther/phablet-tools/skip-missing-click-tests into lp:phablet-tools
Robert Bruce Park
robert.park at canonical.com
Tue Apr 21 23:30:14 UTC 2015
Diff comments:
> === modified file 'phablet-click-test-setup'
> --- phablet-click-test-setup 2014-09-29 16:30:56 +0000
> +++ phablet-click-test-setup 2015-04-21 22:13:08 +0000
> @@ -20,7 +20,7 @@
> from launchpadlib.launchpad import Launchpad
> from phabletutils.device import AndroidBridge
> from os import path
> -from subprocess import (check_call, check_output)
> +from subprocess import (check_call, check_output, CalledProcessError)
>
> import argparse
> import atexit
> @@ -55,6 +55,10 @@
> self._series = distro.getSeries(name_or_version=release)
> self._arch_series = self._series.getDistroArchSeries(archtag=arch)
> self._archive = self.lp.distributions[distribution].main_archive
> + ppa_list = self.lp.people['ci-train-ppa-service'].ppas
> + for p in ppa_list:
> + if p.name == 'stable-phone-overlay':
> + self._ppa = p
>
>
> lp = None
> @@ -157,13 +161,22 @@
> atexit.register(cleanup, tmp_dir)
> print('Fetching %s - into %s' % (package, tmp_dir))
> try:
> - sp = lp.archive.getPublishedSources(
> - source_name=package,
> - version=version,
> - distro_series=lp.series,
> - exact_match=True)
> - # TODO needs filtering
> - source_url = sp[0].sourceFileUrls()[0]
> + try:
> + sp = lp.archive.getPublishedSources(
> + source_name=package,
> + version=version,
> + distro_series=lp.series,
> + exact_match=True)
> + # TODO needs filtering
> + source_url = sp[0].sourceFileUrls()[0]
> + except IndexError as e:
> + sp = lp._ppa.getPublishedSources(
> + source_name=package,
> + version=version,
> + distro_series=lp.series,
> + exact_match=True)
> + # TODO needs filtering
> + source_url = sp[0].sourceFileUrls()[0]
This is even less repeat-y and might also work:
kwargs = dict(source_name=package, version=version, distro_series=lp.series, exact_match=True)
sp = lp.archive.getPublishedSources(**kwargs)
if not sp:
sp = lp._ppa.getPublishedSource(**kwargs)
source_url = sp[0].sourceFileUrls()[0]
> print('Downloading %s version %s from %s' % (package,
> version, source_url))
> url = urllib2.urlopen(source_url)
> @@ -234,10 +247,15 @@
> print('Only keeping entries with x-source')
> manifest = [entry for entry in manifest if 'x-source' in entry]
> for entry in manifest:
> - get_bzr_tests(entry['x-source']['vcs-bzr'],
> - entry['x-source']['vcs-bzr-revno'],
> - 'tests/autopilot',
> - test_dir)
> + try:
> + get_bzr_tests(entry['x-source']['vcs-bzr'],
> + entry['x-source']['vcs-bzr-revno'],
> + 'tests/autopilot',
> + test_dir)
> + except (CalledProcessError, OSError) as e:
> + print('Error: unable to acquire test sources for {}, '
> + 'continuing.'.format(entry['name']))
> + print('Error: {}'.format(e))
>
>
> def main():
>
--
https://code.launchpad.net/~fginther/phablet-tools/skip-missing-click-tests/+merge/256931
Your team Ubuntu Phablet Team is subscribed to branch lp:phablet-tools.
More information about the Ubuntu-reviews
mailing list