@@ -756,9 +756,25 @@ def test_mem_leak_read_all_arctic_lib_memray(library_with_big_symbol_):
756
756
757
757
gc .collect ()
758
758
759
+ @pytest .fixture
760
+ def lmdb_library (lmdb_storage , lib_name , request ) -> Generator [Library , None , None ]:
761
+ """
762
+ Allows passing library creation parameters as parameters of the test or other fixture.
763
+ Example:
764
+
765
+
766
+ @pytest.mark.parametrize("lmdb_library_any", [
767
+ {'library_options': LibraryOptions(rows_per_segment=100, columns_per_segment=100)}
768
+ ], indirect=True)
769
+ def test_my_test(lmdb_library_any):
770
+ .....
771
+ """
772
+ params = request .param if hasattr (request , 'param' ) else {}
773
+ yield lmdb_storage .create_arctic ().create_library (name = lib_name , ** params )
774
+
759
775
760
776
@pytest .fixture
761
- def prepare_head_tails_symbol (lmdb_version_store_modifiable ):
777
+ def prepare_head_tails_symbol (lmdb_library ):
762
778
"""
763
779
This fixture is part of test `test_mem_leak_head_tail_memray`
764
780
@@ -768,8 +784,8 @@ def prepare_head_tails_symbol(lmdb_version_store_modifiable):
768
784
769
785
Should not be reused
770
786
"""
771
- lib : NativeVersionStore = lmdb_version_store_modifiable
772
- opts = lib ._write_options ()
787
+ lib : Library = lmdb_library
788
+ opts = lib .options ()
773
789
774
790
total_number_columns = 1002
775
791
symbol = "asdf12345"
@@ -795,14 +811,13 @@ def prepare_head_tails_symbol(lmdb_version_store_modifiable):
795
811
lib .delete (symbol = symbol )
796
812
797
813
798
-
799
814
@MEMRAY_TESTS_MARK
800
815
@SLOW_TESTS_MARK
801
816
@pytest .mark .limit_leaks (location_limit = "380 KB" if LINUX else "52 KB" , filter_fn = is_relevant )
802
- @pytest .mark .parametrize ("lmdb_version_store_modifiable " , [
803
- { 'segment_row_size ' : 233 , 'column_group_size' : 197 , ' dynamic_schema' : True , ' encoding_version' : int ( EncodingVersion .V2 )},
804
- { 'segment_row_size ' : 99 , 'column_group_size' : 99 , ' dynamic_schema' : False , ' encoding_version' : int ( EncodingVersion .V1 )},
805
- ], indirect = True )
817
+ @pytest .mark .parametrize ("lmdb_library " , [
818
+ { 'library_options ' : LibraryOptions ( rows_per_segment = 233 , columns_per_segment = 197 , dynamic_schema = True , encoding_version = EncodingVersion .V2 )},
819
+ { 'library_options ' : LibraryOptions ( rows_per_segment = 99 , columns_per_segment = 99 , dynamic_schema = False , encoding_version = EncodingVersion .V1 )}
820
+ ], indirect = True )
806
821
def test_mem_leak_head_tail_memray (prepare_head_tails_symbol ):
807
822
"""
808
823
This test aims to test `head` and `tail` functions if they do leak memory.
0 commit comments