@@ -45,13 +45,17 @@ def test_context_manager(self):
4545 """Test database as context manager."""
4646 with TidesDB (self .test_db_path ) as db :
4747 self .assertIsNotNone (db )
48+ # Create a CF with background compaction disabled
49+ config = ColumnFamilyConfig (enable_background_compaction = False )
50+ db .create_column_family ("test_cf" , config )
4851 # Database should be closed after context
4952
5053 def test_create_drop_column_family (self ):
5154 """Test creating and dropping column families."""
5255 with TidesDB (self .test_db_path ) as db :
53- # Create with default config
54- db .create_column_family ("test_cf" )
56+ # Create with background compaction disabled
57+ config = ColumnFamilyConfig (enable_background_compaction = False )
58+ db .create_column_family ("test_cf" , config )
5559
5660 # Verify it exists
5761 cf_list = db .list_column_families ()
@@ -92,10 +96,11 @@ def test_create_column_family_with_config(self):
9296 def test_list_column_families (self ):
9397 """Test listing column families."""
9498 with TidesDB (self .test_db_path ) as db :
95- # Create multiple column families
99+ # Create multiple column families with background compaction disabled
100+ config = ColumnFamilyConfig (enable_background_compaction = False )
96101 cf_names = ["cf1" , "cf2" , "cf3" ]
97102 for name in cf_names :
98- db .create_column_family (name )
103+ db .create_column_family (name , config )
99104
100105 # List them
101106 cf_list = db .list_column_families ()
@@ -107,7 +112,8 @@ def test_list_column_families(self):
107112 def test_transaction_put_get_delete (self ):
108113 """Test basic CRUD operations with transactions."""
109114 with TidesDB (self .test_db_path ) as db :
110- db .create_column_family ("test_cf" )
115+ config = ColumnFamilyConfig (enable_background_compaction = False )
116+ db .create_column_family ("test_cf" , config )
111117
112118 # Put data
113119 with db .begin_txn () as txn :
@@ -136,7 +142,8 @@ def test_transaction_put_get_delete(self):
136142 def test_transaction_with_ttl (self ):
137143 """Test transactions with TTL."""
138144 with TidesDB (self .test_db_path ) as db :
139- db .create_column_family ("test_cf" )
145+ config = ColumnFamilyConfig (enable_background_compaction = False )
146+ db .create_column_family ("test_cf" , config )
140147
141148 # Put with TTL (2 seconds from now)
142149 ttl = int (time .time ()) + 2
@@ -160,7 +167,8 @@ def test_transaction_with_ttl(self):
160167 def test_multi_operation_transaction (self ):
161168 """Test transaction with multiple operations."""
162169 with TidesDB (self .test_db_path ) as db :
163- db .create_column_family ("test_cf" )
170+ config = ColumnFamilyConfig (enable_background_compaction = False )
171+ db .create_column_family ("test_cf" , config )
164172
165173 # Multiple operations in one transaction
166174 with db .begin_txn () as txn :
@@ -181,7 +189,8 @@ def test_multi_operation_transaction(self):
181189 def test_transaction_rollback (self ):
182190 """Test transaction rollback."""
183191 with TidesDB (self .test_db_path ) as db :
184- db .create_column_family ("test_cf" )
192+ config = ColumnFamilyConfig (enable_background_compaction = False )
193+ db .create_column_family ("test_cf" , config )
185194
186195 # Put some data and rollback
187196 with db .begin_txn () as txn :
@@ -196,7 +205,8 @@ def test_transaction_rollback(self):
196205 def test_transaction_auto_rollback_on_exception (self ):
197206 """Test transaction automatically rolls back on exception."""
198207 with TidesDB (self .test_db_path ) as db :
199- db .create_column_family ("test_cf" )
208+ config = ColumnFamilyConfig (enable_background_compaction = False )
209+ db .create_column_family ("test_cf" , config )
200210
201211 # Exception in context manager should trigger rollback
202212 try :
@@ -214,7 +224,8 @@ def test_transaction_auto_rollback_on_exception(self):
214224 def test_iterator_forward (self ):
215225 """Test forward iteration."""
216226 with TidesDB (self .test_db_path ) as db :
217- db .create_column_family ("test_cf" )
227+ config = ColumnFamilyConfig (enable_background_compaction = False )
228+ db .create_column_family ("test_cf" , config )
218229
219230 # Insert test data
220231 test_data = {
@@ -251,7 +262,8 @@ def test_iterator_forward(self):
251262 def test_iterator_backward (self ):
252263 """Test backward iteration."""
253264 with TidesDB (self .test_db_path ) as db :
254- db .create_column_family ("test_cf" )
265+ config = ColumnFamilyConfig (enable_background_compaction = False )
266+ db .create_column_family ("test_cf" , config )
255267
256268 # Insert test data
257269 test_data = {
@@ -286,7 +298,8 @@ def test_iterator_backward(self):
286298 def test_iterator_as_python_iterator (self ):
287299 """Test iterator as Python iterator."""
288300 with TidesDB (self .test_db_path ) as db :
289- db .create_column_family ("test_cf" )
301+ config = ColumnFamilyConfig (enable_background_compaction = False )
302+ db .create_column_family ("test_cf" , config )
290303
291304 # Insert test data
292305 test_data = {
@@ -439,7 +452,8 @@ def test_compression_algorithms(self):
439452 def test_pickle_support (self ):
440453 """Test storing Python objects with pickle."""
441454 with TidesDB (self .test_db_path ) as db :
442- db .create_column_family ("test_cf" )
455+ config = ColumnFamilyConfig (enable_background_compaction = False )
456+ db .create_column_family ("test_cf" , config )
443457
444458 # Store complex Python object
445459 test_obj = {
@@ -476,15 +490,17 @@ def test_error_handling(self):
476490 db .drop_column_family ("nonexistent_cf" )
477491
478492 # Try to get from non-existent CF
479- db .create_column_family ("test_cf" )
493+ config = ColumnFamilyConfig (enable_background_compaction = False )
494+ db .create_column_family ("test_cf" , config )
480495 with db .begin_read_txn () as txn :
481496 with self .assertRaises (TidesDBException ):
482497 txn .get ("nonexistent_cf" , b"key" )
483498
484499 def test_large_values (self ):
485500 """Test storing large values."""
486501 with TidesDB (self .test_db_path ) as db :
487- db .create_column_family ("test_cf" )
502+ config = ColumnFamilyConfig (enable_background_compaction = False )
503+ db .create_column_family ("test_cf" , config )
488504
489505 # Store 1MB value
490506 large_value = b"x" * (1024 * 1024 )
@@ -502,7 +518,8 @@ def test_large_values(self):
502518 def test_many_keys (self ):
503519 """Test storing many keys."""
504520 with TidesDB (self .test_db_path ) as db :
505- db .create_column_family ("test_cf" )
521+ config = ColumnFamilyConfig (enable_background_compaction = False )
522+ db .create_column_family ("test_cf" , config )
506523
507524 num_keys = 1000
508525
0 commit comments