Skip to content

Commit 5e163a5

Browse files
committed
test: Verify that empty directories do not crash the indexer
Closes gh-925 by passing without requiring a fix.
1 parent 5a34b83 commit 5e163a5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/bids/layout/tests/test_layout.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,3 +1195,13 @@ def test_ignore_dotfiles(temporary_dataset):
11951195
assert str(arbitrary_dotfile) not in layout.files
11961196
assert str(ds_store) not in layout.files
11971197
assert str(osx_companion_file) not in layout.files
1198+
1199+
1200+
def test_empty_directory(temporary_dataset):
1201+
anat = temporary_dataset / 'sub-01' / 'anat'
1202+
shutil.rmtree(anat)
1203+
anat.mkdir()
1204+
1205+
layout = BIDSLayout(temporary_dataset)
1206+
1207+
assert layout.get(subject='01', datatype='anat') == []

0 commit comments

Comments
 (0)