Skip to content

Commit 5ccc085

Browse files
committed
Return none not empty path
1 parent d0e7273 commit 5ccc085

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/murfey/client/destinations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def find_longest_data_directory(
2020
Determine the longest path in the data_directories list
2121
which the match path is relative to
2222
"""
23-
base_dir = Path("")
24-
mid_dir = Path("")
23+
base_dir: Path | None = None
24+
mid_dir: Path | None = None
2525
for dd in data_directories:
2626
dd_base = str(Path(dd).absolute())
2727
if str(match_path).startswith(str(dd)) and len(dd_base) > len(str(base_dir)):
@@ -54,7 +54,7 @@ def determine_default_destination(
5454
)
5555
if not base_path:
5656
raise ValueError(f"No data directory found for {source}")
57-
if source.absolute() == Path(base_path).absolute():
57+
if source.absolute() == base_path.absolute():
5858
raise ValueError(
5959
f"Source is the same as the base path {secure_path(source.absolute())}"
6060
)

tests/client/test_destinations.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ def test_determine_default_destinations_failures(mock_get, destination_params):
121121
Test failure of the following cases:
122122
No visit, no destination, source = default, source not in default
123123
"""
124+
mock_get().json.return_value = {
125+
"data_directories": ["X:/DoseFractions", "X:/DoseFractions/DATA"]
126+
}
124127
source, visit, destination, default_dests = destination_params
125128
mock_environment = mock.Mock()
126129
with pytest.raises(ValueError):

0 commit comments

Comments
 (0)