Skip to content

Commit

Permalink
adds use of VisitNotFound
Browse files Browse the repository at this point in the history
  • Loading branch information
David Erb committed Apr 26, 2023
1 parent 8610920 commit 73f31fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dls_utilpack/visit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 6 additions & 2 deletions tests/test_visit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

0 comments on commit 73f31fb

Please sign in to comment.