Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions recipe/meta.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"build": "py_1",
"buildnum": 1,
"build": "py_0",
"buildnum": 0,
"name": "wxvx",
"packages": {
"dev": [
Expand Down Expand Up @@ -50,5 +50,5 @@
"zarr ==3.1.*"
]
},
"version": "0.5.0"
"version": "0.5.1"
}
4 changes: 2 additions & 2 deletions src/wxvx/resources/info.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"buildnum": "1",
"version": "0.5.0"
"buildnum": "0",
"version": "0.5.1"
}
22 changes: 8 additions & 14 deletions src/wxvx/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,13 @@ def test_util_classify_data_format__file_missing(fakefs, logged):
assert logged(f"Path not found: {path}")


def test_util_classify_data_format__file_unrecognized(fakefs):
def test_util_classify_data_format__file_unrecognized(fakefs, logged):
path = fakefs / "datafile"
path.touch()
util.classify_data_format.cache_clear()
with (
patch.object(util.magic, "from_file", return_value="What Is This I Don't Even"),
raises(util.WXVXError) as e,
):
util.classify_data_format(path=path)
assert str(e.value) == f"Could not determine format of {path}"
with patch.object(util.magic, "from_file", return_value="What Is This I Don't Even"):
assert util.classify_data_format(path=path) == util.DataFormat.UNKNOWN
assert logged(f"Could not determine format of {path}")


def test_util_classify_data_format__zarr(fakefs):
Expand All @@ -79,16 +76,13 @@ def test_util_classify_data_format__zarr(fakefs):
assert util.classify_data_format(path=path) == util.DataFormat.ZARR


def test_util_classify_data_format__zarr_corrupt(fakefs):
def test_util_classify_data_format__zarr_corrupt(fakefs, logged):
path = fakefs / "datadir"
path.mkdir()
util.classify_data_format.cache_clear()
with (
patch.object(util.zarr, "open", side_effect=Exception("failure")),
raises(util.WXVXError) as e,
):
util.classify_data_format(path=path)
assert str(e.value) == f"Could not determine format of {path}"
with patch.object(util.zarr, "open", side_effect=Exception("failure")):
assert util.classify_data_format(path=path) == util.DataFormat.UNKNOWN
assert logged(f"Could not determine format of {path}")


def test_util_classify_data_format__zarr_missing(fakefs, logged):
Expand Down
3 changes: 2 additions & 1 deletion src/wxvx/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def classify_data_format(path: str | Path) -> DataFormat:
else:
logging.warning("Path not found: %s", path)
return DataFormat.UNKNOWN
raise WXVXError("Could not determine format of %s" % path)
logging.error("Could not determine format of %s", path)
return DataFormat.UNKNOWN
Comment on lines +95 to +96
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the core change.



def classify_url(url: str) -> tuple[Proximity, str | Path]:
Expand Down