summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Baunton <ebaunton1@bloomberg.net>2018-07-26 14:22:52 +0100
committerEd Baunton <ebaunton1@bloomberg.net>2018-07-26 14:22:52 +0100
commitbd1196efe104991a2a091d1fe4a024dfd690eca0 (patch)
tree3a47a90912cdf91477c7634f5680c47c72f86137
parentc049d021f91ba5b25806dc9066b622a411d78766 (diff)
downloadbuildstream-bd1196efe104991a2a091d1fe4a024dfd690eca0.tar.gz
Provide explicit reason for SourceError exception on path
When the user provides a path for the filename parameter, provide a reason
-rw-r--r--buildstream/plugins/sources/remote.py3
-rw-r--r--tests/sources/remote.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/buildstream/plugins/sources/remote.py b/buildstream/plugins/sources/remote.py
index 77c4ce17d..ad4cdab8b 100644
--- a/buildstream/plugins/sources/remote.py
+++ b/buildstream/plugins/sources/remote.py
@@ -62,7 +62,8 @@ class RemoteSource(DownloadableFileSource):
self.filename = self.node_get_member(node, str, 'filename', os.path.basename(self.url))
if os.sep in self.filename:
- raise SourceError('{}: filename parameter cannot contain directories'.format(self))
+ raise SourceError('{}: filename parameter cannot contain directories'.format(self),
+ reason="filename-contains-directory")
self.node_validate(node, DownloadableFileSource.COMMON_CONFIG_KEYS + ['filename'])
def get_unique_key(self):
diff --git a/tests/sources/remote.py b/tests/sources/remote.py
index f0f695c4f..b7c8c08cf 100644
--- a/tests/sources/remote.py
+++ b/tests/sources/remote.py
@@ -56,7 +56,7 @@ def test_path_in_filename(cli, tmpdir, datafiles):
])
# The bst file has a / in the filename param
- result.assert_main_error(ErrorDomain.SOURCE, None)
+ result.assert_main_error(ErrorDomain.SOURCE, "filename-contains-directory")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'single-file'))