summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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