Skip to content

Commit

Permalink
Add explicit test for get_siav2_handler
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Jan 14, 2025
1 parent 072f746 commit b5b6d58
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions python/lsst/dax/obscore/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

from __future__ import annotations

__all__ = ["get_siav2_handler"]

from importlib.metadata import EntryPoint, entry_points
from typing import TYPE_CHECKING

Expand Down
11 changes: 10 additions & 1 deletion tests/test_siav2.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
from astropy.time import Time
from lsst.daf.butler import Timespan
from lsst.daf.butler.tests.utils import makeTestTempDir, removeTestTempDir
from lsst.dax.obscore.siav2 import Interval, SIAv2Parameters, siav2_query_from_raw
from lsst.dax.obscore.plugins import get_siav2_handler
from lsst.dax.obscore.siav2 import Interval, SIAv2Handler, SIAv2Parameters, siav2_query_from_raw
from lsst.dax.obscore.tests import DaxObsCoreTestMixin
from lsst.utils.iteration import ensure_iterable

Expand Down Expand Up @@ -207,6 +208,14 @@ def test_query(self):
)
self.assertVOTable(votable, expected)

def test_entry_point(self):
"""Test that a handler can be returned by namespace."""
handler = get_siav2_handler("daf_butler")
self.assertTrue(issubclass(handler, SIAv2Handler))

with self.assertRaises(RuntimeError):
get_siav2_handler("unknown")


if __name__ == "__main__":
unittest.main()

0 comments on commit b5b6d58

Please sign in to comment.