Orchestrata Ultimate › Tests › Reference › core › graph

Tests reference — tests/core/graph

tests/core/graph — 8 test modules, 81 test functions. Source tree: tests/core/graph at commit 8a2cb42ad. Generated from the tests AST snapshot by scripts/gen-data-pages.py.

Prose pending.

Modules

Module Tests Covers
conftest.py 0 3
test_bolt_async_repository.py 14 3
test_bolt_sync_repository.py 20 3
test_config.py 6 1
test_interfaces.py 9 3
test_mvcc_retry.py 2 3
test_repository_factory.py 8 5
test_retry.py 22 1

Module details

tests/core/graph/conftest.py

source · 0 tests · 71 lines

Function-scope fixtures shared by tests/core/graph/*.

Covers: core.graph.adapters.bolt_async, core.graph.adapters.bolt_sync, core.graph_factory

tests/core/graph/test_bolt_async_repository.py

source · 14 tests · 183 lines

Tests for core.graph.adapters.bolt_async.BoltAsyncRepository.

Covers: core.graph.adapters.bolt_async, core.graph.config, core.graph_factory

Kind Name Line Description
class TestReadWriteRoundTrip 20
method TestReadWriteRoundTrip.test_write_then_read_round_trip 21
method TestReadWriteRoundTrip.test_execute_read_returns_list_of_dicts 32
method TestReadWriteRoundTrip.test_params_default_to_empty_when_none 52
method TestReadWriteRoundTrip.test_params_normalize_mapping_types 56
class TestOwnershipSemantics 71
method TestOwnershipSemantics.test_owned_repository_close_closes_the_driver 72
method TestOwnershipSemantics.test_shared_repository_close_is_a_noop 81
method TestOwnershipSemantics.test_shared_repository_does_not_own_driver_flag 110
method TestOwnershipSemantics.test_owned_repository_owns_driver_flag 114
class TestVerifyConnectivity 120
method TestVerifyConnectivity.test_verify_connectivity_succeeds_against_real_neo4j 121
class TestDriverEscapeHatch 125
method TestDriverEscapeHatch.test_driver_property_returns_usable_raw_driver 126
method TestDriverEscapeHatch.test_driver_property_is_lazy_and_memoized 139
class TestDatabaseRouting 147
method TestDatabaseRouting.test_explicit_database_matches_config_default_database 148
method TestDatabaseRouting.test_session_kwargs_falls_back_to_kg_database_env_when_unset 171
method TestDatabaseRouting.test_session_kwargs_uses_per_call_database_over_config 180

tests/core/graph/test_bolt_sync_repository.py

source · 20 tests · 332 lines

Tests for core.graph.adapters.bolt_sync.BoltSyncRepository.

Covers: core.graph.adapters.bolt_sync, core.graph.config, core.graph_factory

Kind Name Line Description
function test_lazy_driver_creation_is_thread_safe 287 On free-threaded 3.14t, N threads racing the lazy .driver property
function test_driver_kwargs_reach_the_constructed_driver 317 driver_kwargs forward verbatim to create_graph — a repository built
class TestReadWriteRoundTrip 22
method TestReadWriteRoundTrip.test_write_then_read_round_trip 23
method TestReadWriteRoundTrip.test_execute_read_returns_list_of_dicts 34
method TestReadWriteRoundTrip.test_params_default_to_empty_when_none 54
method TestReadWriteRoundTrip.test_execute_autocommit_round_trip 60
method TestReadWriteRoundTrip.test_params_normalize_mapping_types 75
class TestUnitOfWork 92
method TestUnitOfWork.test_unit_of_work_commits_n_statements_atomically 93
method TestUnitOfWork.test_unit_of_work_rolls_back_on_exception 115
method TestUnitOfWork.test_unit_of_work_run_returns_rows 134
class TestOwnershipSemantics 147
method TestOwnershipSemantics.test_owned_repository_close_closes_the_driver 148
method TestOwnershipSemantics.test_shared_repository_close_is_a_noop 158
method TestOwnershipSemantics.test_shared_repository_does_not_own_driver_flag 188
method TestOwnershipSemantics.test_owned_repository_owns_driver_flag 192
class TestVerifyConnectivity 198
method TestVerifyConnectivity.test_verify_connectivity_succeeds_against_real_neo4j 199
class TestDriverEscapeHatch 203
method TestDriverEscapeHatch.test_driver_property_returns_usable_raw_driver 204
method TestDriverEscapeHatch.test_driver_property_is_lazy_and_memoized 215
class TestDatabaseRouting 223
method TestDatabaseRouting.test_explicit_database_kwarg_routes_and_isolates 224 A per-call database= must ROUTE the statement, not be ignored.
method TestDatabaseRouting.test_session_kwargs_falls_back_to_kg_database_env_when_unset 267
method TestDatabaseRouting.test_session_kwargs_uses_per_call_database_over_config 280

tests/core/graph/test_config.py

source · 6 tests · 56 lines

Tests for core.graph.config — GraphRepositoryConfig.

Covers: core.graph.config

Kind Name Line Description
function test_driver_kwargs_default_to_empty_dict 45
function test_driver_kwargs_pass_through_unchanged 54
class TestGraphRepositoryConfig 8
method TestGraphRepositoryConfig.test_defaults_are_all_none 9
method TestGraphRepositoryConfig.test_from_env_defers_all_resolution 15
method TestGraphRepositoryConfig.test_explicit_values_pass_through_unchanged 27
method TestGraphRepositoryConfig.test_is_a_plain_dataclass_equality 37

tests/core/graph/test_interfaces.py

source · 9 tests · 113 lines

Tests for core.graph.interfaces — the Protocol surface.

Covers: core.graph.adapters.bolt_async, core.graph.adapters.bolt_sync, core.graph.interfaces

Kind Name Line Description
class TestSyncGraphRepositoryProtocol 24
method TestSyncGraphRepositoryProtocol.test_bolt_sync_repository_is_a_sync_graph_repository 25
method TestSyncGraphRepositoryProtocol.test_duck_typed_object_satisfies_protocol 29
method TestSyncGraphRepositoryProtocol.test_object_missing_a_method_does_not_satisfy_protocol 51
class TestAsyncGraphRepositoryProtocol 64
method TestAsyncGraphRepositoryProtocol.test_bolt_async_repository_is_an_async_graph_repository 65
method TestAsyncGraphRepositoryProtocol.test_duck_typed_object_satisfies_protocol 69
method TestAsyncGraphRepositoryProtocol.test_object_missing_a_method_does_not_satisfy_protocol 85
class TestUnitOfWorkProtocol 95
method TestUnitOfWorkProtocol.test_duck_typed_object_satisfies_protocol 96
method TestUnitOfWorkProtocol.test_object_missing_run_does_not_satisfy_protocol 103
method TestUnitOfWorkProtocol.test_real_unit_of_work_from_sync_repository_satisfies_protocol 109

tests/core/graph/test_mvcc_retry.py

source · 2 tests · 322 lines

Live concurrent-writer proof: Memgraph MVCC write-conflict retry.

Covers: core.graph.adapters.bolt_sync, core.graph.config, core.graph.retry

Kind Name Line Description
function test_repo_execute_write_survives_concurrent_conflicts_via_retry 211 Two threads MERGE the SAME node 100x each through
function test_raw_autocommit_session_demonstrates_the_mvcc_abort_class_is_real 264 Negative control / "no-retry probe": the SAME hammer workload run

tests/core/graph/test_repository_factory.py

source · 8 tests · 89 lines

Tests for core.graph.repository — create_graph_repository / create_async_graph_repository.

Covers: core.graph.adapters.bolt_async, core.graph.adapters.bolt_sync, core.graph.config, core.graph.interfaces, core.graph.repository

Kind Name Line Description
class TestCreateGraphRepository 22
method TestCreateGraphRepository.test_default_config_returns_bolt_sync_repository 23
method TestCreateGraphRepository.test_uses_env_resolution_and_can_connect 31
method TestCreateGraphRepository.test_explicit_config_is_passed_through 41
method TestCreateGraphRepository.test_injected_driver_is_shared_not_owned 50
class TestCreateAsyncGraphRepository 59
method TestCreateAsyncGraphRepository.test_default_config_returns_bolt_async_repository 60
method TestCreateAsyncGraphRepository.test_uses_env_resolution_and_can_connect 68
method TestCreateAsyncGraphRepository.test_explicit_config_is_passed_through 75
method TestCreateAsyncGraphRepository.test_injected_driver_is_shared_not_owned 84

tests/core/graph/test_retry.py

source · 22 tests · 222 lines

Tests for core.graph.retry — the Memgraph MVCC write-conflict retry.

Covers: core.graph.retry

Kind Name Line Description
class TestIsMvccConflictMessage 26
method TestIsMvccConflictMessage.test_matches_cannot_resolve_conflicting_transactions 27
method TestIsMvccConflictMessage.test_matches_transient_error_substring 32
method TestIsMvccConflictMessage.test_matches_serialization_error_substring 35
method TestIsMvccConflictMessage.test_unrelated_message_does_not_match 38
class TestIsMvccConflict 43
method TestIsMvccConflict.test_real_transient_error_with_conflict_message_is_mvcc 44
method TestIsMvccConflict.test_transient_error_type_name_alone_is_mvcc 48
method TestIsMvccConflict.test_service_unavailable_is_not_mvcc 56
method TestIsMvccConflict.test_client_error_without_conflict_marker_is_not_mvcc 59
method TestIsMvccConflict.test_client_error_carrying_conflict_message_is_mvcc 62
method TestIsMvccConflict.test_unique_constraint_violation_from_a_concurrent_merge_is_mvcc 69
method TestIsMvccConflict.test_neo4j_already_exists_shape_is_mvcc 78
method TestIsMvccConflict.test_unknown_database_is_permanent_despite_the_transient_class 84 A missing database is reported TRANSIENT but can never succeed.
method TestIsMvccConflict.test_unknown_database_is_not_retried 102
class TestRetryOnMvccConflict 114
method TestRetryOnMvccConflict.test_succeeds_immediately_when_fn_does_not_raise 115
method TestRetryOnMvccConflict.test_non_mvcc_exception_propagates_without_retry 125
method TestRetryOnMvccConflict.test_retries_then_succeeds_within_budget 136
method TestRetryOnMvccConflict.test_exhausts_budget_and_reraises_last_exception 148
method TestRetryOnMvccConflict.test_backoff_is_bounded_by_max_attempts_ceiling 159
class TestRetryOnMvccConflictAsync 179
method TestRetryOnMvccConflictAsync.test_succeeds_immediately_when_fn_does_not_raise 180
method TestRetryOnMvccConflictAsync.test_non_mvcc_exception_propagates_without_retry 190
method TestRetryOnMvccConflictAsync.test_retries_then_succeeds_within_budget 201
method TestRetryOnMvccConflictAsync.test_exhausts_budget_and_reraises_last_exception 213