You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by gi...@apache.org on 2020/12/29 13:16:32 UTC
[buildstream] 03/04: Additional test for invalid path
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch becky/locally_downloaded_files
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit b67afa85dc6a1a59eae751128deebaa55b250484
Author: Rebecca Grayson <be...@hotmail.co.uk>
AuthorDate: Thu Jun 27 15:08:54 2019 +0100
Additional test for invalid path
A test has been added to ensure if path is equal to anything other
than None, errors are handled correctly.
---
tests/sources/tar.py | 13 +++++++++++++
tests/sources/tar/fetch/target-no-path.bst | 5 +++++
2 files changed, 18 insertions(+)
diff --git a/tests/sources/tar.py b/tests/sources/tar.py
index 68791cb..553b6e2 100644
--- a/tests/sources/tar.py
+++ b/tests/sources/tar.py
@@ -86,6 +86,19 @@ def test_fetch_bad_url(cli, tmpdir, datafiles):
result.assert_main_error(ErrorDomain.STREAM, None)
result.assert_task_error(ErrorDomain.SOURCE, None)
+# Test that when I fetch an invalid path, errors are handled gracefully.
+@pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch'))
+def test_fetch_invalid_path(cli, tmpdir, datafiles):
+ project = str(datafiles)
+ generate_project(project, tmpdir)
+
+ # Try to fetch it
+ result = cli.run(project=project, args=[
+ 'source', 'fetch', 'target-no-path.bst'
+ ])
+ result.assert_main_error(ErrorDomain.STREAM, None)
+ result.assert_task_error(ErrorDomain.SOURCE, None)
+
# Test that when I fetch a nonexistent path, errors are handled gracefully.
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch'))
def test_fetch_bad_path(cli, tmpdir, datafiles):
diff --git a/tests/sources/tar/fetch/target-no-path.bst b/tests/sources/tar/fetch/target-no-path.bst
new file mode 100644
index 0000000..56e4e05
--- /dev/null
+++ b/tests/sources/tar/fetch/target-no-path.bst
@@ -0,0 +1,5 @@
+kind: import
+description: The kind of this element is irrelevant.
+sources:
+- kind: tar
+ path: ""