Skip to content

Commit 73f31fb

Browse files
author
David Erb
committed
adds use of VisitNotFound
1 parent 8610920 commit 73f31fb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/dls_utilpack/visit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ def get_xchem_directory(parent, visit):
6363
full_path = Path(parent) / subdirectory
6464

6565
if not full_path.is_dir():
66-
raise RuntimeError(f"the visit directory {str(full_path)} does not exist")
66+
raise VisitNotFound(f"the visit directory {str(full_path)} does not exist")
6767

6868
return str(full_path)

tests/test_visit.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
import pytest
55

6-
from dls_utilpack.visit import get_xchem_directory, get_xchem_subdirectory
6+
from dls_utilpack.visit import (
7+
VisitNotFound,
8+
get_xchem_directory,
9+
get_xchem_subdirectory,
10+
)
711

812
# Base class for the tester.
913
from tests.base_tester import BaseTester
@@ -59,6 +63,6 @@ async def _main_coroutine(
5963
assert get_xchem_directory(str(parent), "aa12345-1") == str(full_path)
6064

6165
# Check invalid directory.
62-
with pytest.raises(RuntimeError) as excinfo:
66+
with pytest.raises(VisitNotFound) as excinfo:
6367
get_xchem_directory("something", "aa12345-1")
6468
assert "does not exist" in str(excinfo.value)

0 commit comments

Comments
 (0)