Skip to content

Commit

Permalink
Test get_upath_for_protocol is only called once
Browse files Browse the repository at this point in the history
  • Loading branch information
camposandro committed Mar 4, 2025
1 parent 458b040 commit 246b1be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/hats/io/file_io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
find_files_matching_path,
get_directory_contents,
get_upath,
get_upath_for_protocol,
is_regular_file,
)
8 changes: 8 additions & 0 deletions tests/hats/catalog/loaders/test_read_hats.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from hats.io.file_io import get_upath_for_protocol
from hats.loaders import read_hats


Expand All @@ -17,3 +18,10 @@ def test_read_hats_branches(
read_hats(margin_catalog_path)
read_hats(small_sky_source_dir)
read_hats(test_data_dir / "square_map")


def test_read_hats_initializes_upath_once(small_sky_dir, mocker):
mock_method = "hats.io.file_io.file_pointer.get_upath_for_protocol"
mocked_upath_call = mocker.patch(mock_method, side_effect=get_upath_for_protocol)
read_hats(small_sky_dir)
mocked_upath_call.assert_called_once_with(small_sky_dir)

0 comments on commit 246b1be

Please sign in to comment.