Skip to content

Commit 9f5ddb3

Browse files
Georgi RusevGeorgi Rusev
Georgi Rusev
authored and
Georgi Rusev
committed
rollback to initial implementation
1 parent 0456a0d commit 9f5ddb3

File tree

2 files changed

+25
-37
lines changed

2 files changed

+25
-37
lines changed

python/tests/conftest.py

+2-29
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,8 @@ def lmdb_storage(tmp_path) -> Generator[LmdbStorageFixture, None, None]:
125125

126126

127127
@pytest.fixture
128-
def lmdb_library(lmdb_storage, lib_name, request) -> Generator[Library, None, None]:
129-
"""
130-
Allows passing library creation parameters as parameters of the test or other fixture.
131-
Example:
132-
133-
134-
@pytest.mark.parametrize("lmdb_library_any", [
135-
{'library_options': LibraryOptions(rows_per_segment=100, columns_per_segment=100)}
136-
], indirect=True)
137-
def test_my_test(lmdb_library_any):
138-
.....
139-
"""
140-
params = request.param if hasattr(request, 'param') else {}
141-
yield lmdb_storage.create_arctic().create_library(name=lib_name, **params)
128+
def lmdb_library(lmdb_storage, lib_name) -> Generator[Library, None, None]:
129+
return lmdb_storage.create_arctic().create_library(lib_name)
142130

143131

144132
@pytest.fixture
@@ -728,21 +716,6 @@ def lmdb_version_store_v1(version_store_factory) -> NativeVersionStore:
728716
return version_store_factory(dynamic_strings=True)
729717

730718

731-
@pytest.fixture
732-
def lmdb_version_store_modifiable(request, lib_name, version_store_factory) -> NativeVersionStore:
733-
"""
734-
Provides ability to pass parameters from test using notation following leaving decision
735-
what options to iterate through to the test:
736-
737-
@pytest.mark.parametrize("lmdb_library_any", [
738-
{'dynamic_strings': True, 'encoding_version' : int(EncodingVersion.V2)}
739-
], indirect=True)
740-
def test_my_test(lmdb_library_any):
741-
"""
742-
params = request.param if hasattr(request, 'param') else {}
743-
return version_store_factory(name=lib_name, **params)
744-
745-
746719
@pytest.fixture
747720
def lmdb_version_store_v2(version_store_factory, lib_name) -> NativeVersionStore:
748721
library_name = lib_name + "_v2"

python/tests/stress/arcticdb/version_store/test_mem_leaks.py

+23-8
Original file line numberDiff line numberDiff line change
@@ -756,9 +756,25 @@ def test_mem_leak_read_all_arctic_lib_memray(library_with_big_symbol_):
756756

757757
gc.collect()
758758

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+
759775

760776
@pytest.fixture
761-
def prepare_head_tails_symbol(lmdb_version_store_modifiable):
777+
def prepare_head_tails_symbol(lmdb_library):
762778
"""
763779
This fixture is part of test `test_mem_leak_head_tail_memray`
764780
@@ -768,8 +784,8 @@ def prepare_head_tails_symbol(lmdb_version_store_modifiable):
768784
769785
Should not be reused
770786
"""
771-
lib: NativeVersionStore = lmdb_version_store_modifiable
772-
opts = lib._write_options()
787+
lib: Library = lmdb_library
788+
opts = lib.options()
773789

774790
total_number_columns = 1002
775791
symbol = "asdf12345"
@@ -795,14 +811,13 @@ def prepare_head_tails_symbol(lmdb_version_store_modifiable):
795811
lib.delete(symbol=symbol)
796812

797813

798-
799814
@MEMRAY_TESTS_MARK
800815
@SLOW_TESTS_MARK
801816
@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)
806821
def test_mem_leak_head_tail_memray(prepare_head_tails_symbol):
807822
"""
808823
This test aims to test `head` and `tail` functions if they do leak memory.

0 commit comments

Comments
 (0)