Skip to content

Commit 55728a0

Browse files
authored
Use is_dir instead of dir_size for non-existent folders after index deletion (#571)
1 parent 64eb084 commit 55728a0

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

apis/python/test/test_index.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_flat_index(tmp_path):
111111
vfs = tiledb.VFS()
112112
assert vfs.dir_size(uri) > 0
113113
Index.delete_index(uri=uri, config={})
114-
assert vfs.dir_size(uri) == 0
114+
assert not vfs.is_dir(uri)
115115

116116

117117
def test_ivf_flat_index(tmp_path):
@@ -196,7 +196,7 @@ def test_ivf_flat_index(tmp_path):
196196
vfs = tiledb.VFS()
197197
assert vfs.dir_size(uri) > 0
198198
Index.delete_index(uri=uri, config={})
199-
assert vfs.dir_size(uri) == 0
199+
assert not vfs.is_dir(uri)
200200

201201

202202
def test_vamana_index_simple(tmp_path):
@@ -217,7 +217,7 @@ def test_vamana_index_simple(tmp_path):
217217
vfs = tiledb.VFS()
218218
assert vfs.dir_size(uri) > 0
219219
Index.delete_index(uri=uri, config={})
220-
assert vfs.dir_size(uri) == 0
220+
assert not vfs.is_dir(uri)
221221

222222

223223
def test_vamana_index(tmp_path):
@@ -298,7 +298,7 @@ def test_vamana_index(tmp_path):
298298
vfs = tiledb.VFS()
299299
assert vfs.dir_size(uri) > 0
300300
Index.delete_index(uri=uri, config={})
301-
assert vfs.dir_size(uri) == 0
301+
assert not vfs.is_dir(uri)
302302

303303

304304
def test_ivf_pq_index(tmp_path):
@@ -407,7 +407,7 @@ def test_ivf_pq_index(tmp_path):
407407
vfs = tiledb.VFS()
408408
assert vfs.dir_size(uri) > 0
409409
Index.delete_index(uri=uri, config={})
410-
assert vfs.dir_size(uri) == 0
410+
assert not vfs.is_dir(uri)
411411

412412

413413
def test_delete_invalid_index(tmp_path):
@@ -429,7 +429,7 @@ def test_delete_index(tmp_path):
429429
num_subspaces=1,
430430
)
431431
Index.delete_index(uri=index_uri, config={})
432-
assert vfs.dir_size(index_uri) == 0
432+
assert not vfs.is_dir(index_uri)
433433
with pytest.raises(tiledb.TileDBError) as error:
434434
open(uri=index_uri)
435435
assert "does not exist" in str(error.value)
@@ -459,7 +459,7 @@ def test_index_with_incorrect_dimensions(tmp_path):
459459

460460
assert vfs.dir_size(uri) > 0
461461
Index.delete_index(uri=uri, config={})
462-
assert vfs.dir_size(uri) == 0
462+
assert not vfs.is_dir(uri)
463463

464464

465465
def test_index_with_incorrect_num_of_query_columns_simple(tmp_path):
@@ -524,7 +524,7 @@ def test_index_with_incorrect_num_of_query_columns_complex(tmp_path):
524524

525525
assert vfs.dir_size(index_uri) > 0
526526
Index.delete_index(uri=index_uri, config={})
527-
assert vfs.dir_size(index_uri) == 0
527+
assert not vfs.is_dir(index_uri)
528528

529529

530530
def test_index_with_incorrect_num_of_query_columns_in_single_vector_query(tmp_path):

apis/python/test/test_ingestion.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_vamana_ingestion_u8(tmp_path):
7979

8080
assert vfs.dir_size(index_uri) > 0
8181
Index.delete_index(uri=index_uri, config={})
82-
assert vfs.dir_size(index_uri) == 0
82+
assert not vfs.is_dir(index_uri)
8383

8484

8585
def test_flat_ingestion_u8(tmp_path):
@@ -376,7 +376,7 @@ def test_ingestion_fvec(tmp_path):
376376

377377
assert vfs.dir_size(index_uri) > 0
378378
Index.delete_index(uri=index_uri, config={})
379-
assert vfs.dir_size(index_uri) == 0
379+
assert not vfs.is_dir(index_uri)
380380

381381

382382
def test_ingestion_numpy(tmp_path):
@@ -430,7 +430,7 @@ def test_ingestion_numpy(tmp_path):
430430

431431
assert vfs.dir_size(index_uri) > 0
432432
Index.delete_index(uri=index_uri, config={})
433-
assert vfs.dir_size(index_uri) == 0
433+
assert not vfs.is_dir(index_uri)
434434

435435

436436
def test_ingestion_numpy_i8(tmp_path):
@@ -486,7 +486,7 @@ def test_ingestion_numpy_i8(tmp_path):
486486

487487
assert vfs.dir_size(index_uri) > 0
488488
Index.delete_index(uri=index_uri, config={})
489-
assert vfs.dir_size(index_uri) == 0
489+
assert not vfs.is_dir(index_uri)
490490

491491

492492
def test_ingestion_multiple_workers(tmp_path):
@@ -541,7 +541,7 @@ def test_ingestion_multiple_workers(tmp_path):
541541

542542
assert vfs.dir_size(index_uri) > 0
543543
Index.delete_index(uri=index_uri, config={})
544-
assert vfs.dir_size(index_uri) == 0
544+
assert not vfs.is_dir(index_uri)
545545

546546

547547
def test_ingestion_external_ids_numpy(tmp_path):
@@ -590,7 +590,7 @@ def test_ingestion_external_ids_numpy(tmp_path):
590590

591591
assert vfs.dir_size(index_uri) > 0
592592
Index.delete_index(uri=index_uri, config={})
593-
assert vfs.dir_size(index_uri) == 0
593+
assert not vfs.is_dir(index_uri)
594594

595595

596596
def test_ingestion_timetravel(tmp_path):
@@ -935,7 +935,7 @@ def test_ingestion_with_updates(tmp_path):
935935

936936
assert vfs.dir_size(index_uri) > 0
937937
Index.delete_index(uri=index_uri, config={})
938-
assert vfs.dir_size(index_uri) == 0
938+
assert not vfs.is_dir(index_uri)
939939

940940

941941
def test_ingestion_with_batch_updates(tmp_path):
@@ -1003,7 +1003,7 @@ def test_ingestion_with_batch_updates(tmp_path):
10031003

10041004
assert vfs.dir_size(index_uri) > 0
10051005
Index.delete_index(uri=index_uri, config={})
1006-
assert vfs.dir_size(index_uri) == 0
1006+
assert not vfs.is_dir(index_uri)
10071007

10081008

10091009
def test_ingestion_with_updates_and_timetravel(tmp_path):
@@ -1277,7 +1277,7 @@ def test_ingestion_with_updates_and_timetravel(tmp_path):
12771277

12781278
assert vfs.dir_size(index_uri) > 0
12791279
Index.delete_index(uri=index_uri, config={})
1280-
assert vfs.dir_size(index_uri) == 0
1280+
assert not vfs.is_dir(index_uri)
12811281

12821282

12831283
def test_ingestion_with_additions_and_timetravel(tmp_path):
@@ -1335,7 +1335,7 @@ def test_ingestion_with_additions_and_timetravel(tmp_path):
13351335

13361336
assert vfs.dir_size(index_uri) > 0
13371337
Index.delete_index(uri=index_uri, config={})
1338-
assert vfs.dir_size(index_uri) == 0
1338+
assert not vfs.is_dir(index_uri)
13391339

13401340

13411341
def test_ivf_flat_ingestion_tdb_random_sampling_policy(tmp_path):

0 commit comments

Comments
 (0)