summaryrefslogtreecommitdiff
path: root/tests/sources/git.py
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-12-29 19:39:35 -0500
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-01-01 19:44:53 +0900
commitc6df92fcbec1300334cdb1a79fdfa633fb3385fb (patch)
tree4ecce9db0109df4c0340c65119c71c19ba6e84bf /tests/sources/git.py
parentfbdb5118f6322cf2f5e8bdb24bc7c5a8fdd374bc (diff)
downloadbuildstream-c6df92fcbec1300334cdb1a79fdfa633fb3385fb.tar.gz
tests/sources: Use new error checking tools for source tests
Also added a test case for the `patch` plugin which checks for graceful failure when the specified patch file is not a regular file (but a block device or a named pipe instead).
Diffstat (limited to 'tests/sources/git.py')
-rw-r--r--tests/sources/git.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/sources/git.py b/tests/sources/git.py
index f3b148a61..39de0b92b 100644
--- a/tests/sources/git.py
+++ b/tests/sources/git.py
@@ -1,7 +1,7 @@
import os
import pytest
-from buildstream._pipeline import PipelineError
+from buildstream._exceptions import ErrorDomain
from buildstream import _yaml
from tests.testutils import cli, create_repo
@@ -35,9 +35,8 @@ def test_fetch_bad_ref(cli, tmpdir, datafiles):
result = cli.run(project=project, args=[
'fetch', 'target.bst'
])
- assert result.exit_code != 0
- assert result.exception
- assert isinstance(result.exception, PipelineError)
+ result.assert_main_error(ErrorDomain.PIPELINE, None)
+ result.assert_task_error(ErrorDomain.SOURCE, None)
@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
@@ -68,11 +67,11 @@ def test_submodule_fetch_checkout(cli, tmpdir, datafiles):
# Fetch, build, checkout
result = cli.run(project=project, args=['fetch', 'target.bst'])
- assert result.exit_code == 0
+ result.assert_success()
result = cli.run(project=project, args=['build', 'target.bst'])
- assert result.exit_code == 0
+ result.assert_success()
result = cli.run(project=project, args=['checkout', 'target.bst', checkoutdir])
- assert result.exit_code == 0
+ result.assert_success()
# Assert we checked out both files at their expected location
assert os.path.exists(os.path.join(checkoutdir, 'file.txt'))