diff options
-rw-r--r-- | gbp/scripts/import_dsc.py | 5 | ||||
-rw-r--r-- | tests/component/deb/test_import_dsc.py | 13 |
2 files changed, 17 insertions, 1 deletions
diff --git a/gbp/scripts/import_dsc.py b/gbp/scripts/import_dsc.py index a6ec09ba..aa88bec8 100644 --- a/gbp/scripts/import_dsc.py +++ b/gbp/scripts/import_dsc.py @@ -59,7 +59,10 @@ def download_source(pkg, dirs, unauth): gbp.log.info("Downloading '%s' using '%s'..." % (pkg, cmd)) gbpc.RunAtCommand(cmd, opts, shell=False)(dir=dirs['download']) - dsc = glob.glob(os.path.join(dirs['download'], '*.dsc'))[0] + try: + dsc = glob.glob(os.path.join(dirs['download'], '*.dsc'))[0] + except IndexError: + raise GbpError("Did not find a dsc file at %s/" % dirs['download']) return dsc diff --git a/tests/component/deb/test_import_dsc.py b/tests/component/deb/test_import_dsc.py index 947c2baf..a0d790c9 100644 --- a/tests/component/deb/test_import_dsc.py +++ b/tests/component/deb/test_import_dsc.py @@ -71,6 +71,19 @@ class TestImportDsc(ComponentTestBase): self._check_repo_state(repo, 'master', ['master']) assert len(repo.get_commits()) == 1 + @skipUnless(os.getenv("GBP_NETWORK_TESTS"), "network tests disabled") + def test_broken_download(self): + def _not_a_dsc(version): + return os.path.join(DEB_TEST_DOWNLOAD_URL, + 'dsc-3.0', + 'hello-debhelper_%s.orig.tar.gz' % version) + + f = _not_a_dsc('2.6') + assert import_dsc(['arg0', + '--allow-unauthenticated', + f]) == 1 + self._check_log(-1, "gbp:error: Did not find a dsc file at") + def test_create_branches(self): """Test if creating missing branches works""" def _dsc(version): |