diff --git a/src/dls_utilpack/visit.py b/src/dls_utilpack/visit.py index 2ef9f91..3367596 100644 --- a/src/dls_utilpack/visit.py +++ b/src/dls_utilpack/visit.py @@ -63,6 +63,6 @@ def get_xchem_directory(parent, visit): full_path = Path(parent) / subdirectory if not full_path.is_dir(): - raise RuntimeError(f"the visit directory {str(full_path)} does not exist") + raise VisitNotFound(f"the visit directory {str(full_path)} does not exist") return str(full_path) diff --git a/tests/test_visit.py b/tests/test_visit.py index 443002d..df2aaf3 100644 --- a/tests/test_visit.py +++ b/tests/test_visit.py @@ -3,7 +3,11 @@ import pytest -from dls_utilpack.visit import get_xchem_directory, get_xchem_subdirectory +from dls_utilpack.visit import ( + VisitNotFound, + get_xchem_directory, + get_xchem_subdirectory, +) # Base class for the tester. from tests.base_tester import BaseTester @@ -59,6 +63,6 @@ async def _main_coroutine( assert get_xchem_directory(str(parent), "aa12345-1") == str(full_path) # Check invalid directory. - with pytest.raises(RuntimeError) as excinfo: + with pytest.raises(VisitNotFound) as excinfo: get_xchem_directory("something", "aa12345-1") assert "does not exist" in str(excinfo.value)