summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarius Makovsky <traveltissues@protonmail.com>2019-07-25 10:17:04 +0100
committerDarius Makovsky <traveltissues@protonmail.com>2019-07-25 10:24:34 +0100
commitcfd22941f712f9728b3354fc98dc57e3b9631d1c (patch)
treedc5c8b944ac063ee90bfffb513bfd90fb7c7823b
parentfa1eba3895202323a42da51aa4bd7dca38ecc125 (diff)
downloadbuildstream-traveltissues/raises.tar.gz
Expect descend raises VirtualDirectoryErrortraveltissues/raises
-rw-r--r--tests/internals/storage_vdir_import.py23
1 files changed, 8 insertions, 15 deletions
diff --git a/tests/internals/storage_vdir_import.py b/tests/internals/storage_vdir_import.py
index b5463af1b..c25ab0cea 100644
--- a/tests/internals/storage_vdir_import.py
+++ b/tests/internals/storage_vdir_import.py
@@ -310,27 +310,20 @@ def test_bad_symlinks(tmpdir):
]
generate_import_root(test_dir, filesys_discription)
d.import_files(test_dir)
+ exp_reason = "not-a-directory"
+ msg = "descend() failed to raise a VirtualDirectoryError"
- try:
+ with pytest.raises(VirtualDirectoryError, message=msg) as error:
d.descend('a', 'l', follow_symlinks=True)
- except VirtualDirectoryError as error:
- assert error.reason == "not-a-directory"
- else:
- raise Exception("Should have had a error")
+ assert error.reason == exp_reason
- try:
+ with pytest.raises(VirtualDirectoryError, message=msg) as error:
d.descend('a', 'l')
- except VirtualDirectoryError as error:
- assert error.reason == "not-a-directory"
- else:
- raise Exception("Should have had a error")
+ assert error.reason == exp_reason
- try:
+ with pytest.raises(VirtualDirectoryError, message=msg) as error:
d.descend('a', 'f')
- except VirtualDirectoryError as error:
- assert error.reason == "directory-not-found"
- else:
- raise Exception("Should have had a error")
+ assert error.reason == exp_reason
# Check symlink logic for edgecases