Skip to content

Remove session config ignore_bookmark_manager #792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion neo4j/_async/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ def session(
fetch_size: int = ...,
impersonated_user: t.Optional[str] = ...,
bookmarks: t.Union[t.Iterable[str], Bookmarks, None] = ...,
ignore_bookmark_manager: bool = ...,
default_access_mode: str = ...,
bookmark_manager: t.Union[AsyncBookmarkManager,
BookmarkManager, None] = ...,
Expand Down
3 changes: 1 addition & 2 deletions neo4j/_async/work/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ def __init__(self, pool, session_config):
assert isinstance(session_config, SessionConfig)
super().__init__(pool, session_config)
self._initialize_bookmarks(session_config.bookmarks)
if not session_config.ignore_bookmark_manager:
self._bookmark_manager = session_config.bookmark_manager
self._bookmark_manager = session_config.bookmark_manager

async def __aenter__(self) -> AsyncSession:
return self
Expand Down
3 changes: 0 additions & 3 deletions neo4j/_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,6 @@ class SessionConfig(WorkspaceConfig):
#: Default AccessMode
default_access_mode = WRITE_ACCESS

#: Whether to ignore the bookmark manager configured at driver level
ignore_bookmark_manager = False


class TransactionConfig(Config):
""" Transaction configuration. This is internal for now.
Expand Down
1 change: 0 additions & 1 deletion neo4j/_sync/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ def session(
fetch_size: int = ...,
impersonated_user: t.Optional[str] = ...,
bookmarks: t.Union[t.Iterable[str], Bookmarks, None] = ...,
ignore_bookmark_manager: bool = ...,
default_access_mode: str = ...,
bookmark_manager: t.Union[BookmarkManager,
BookmarkManager, None] = ...,
Expand Down
3 changes: 1 addition & 2 deletions neo4j/_sync/work/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ def __init__(self, pool, session_config):
assert isinstance(session_config, SessionConfig)
super().__init__(pool, session_config)
self._initialize_bookmarks(session_config.bookmarks)
if not session_config.ignore_bookmark_manager:
self._bookmark_manager = session_config.bookmark_manager
self._bookmark_manager = session_config.bookmark_manager

def __enter__(self) -> Session:
return self
Expand Down
1 change: 0 additions & 1 deletion testkitbackend/_async/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ async def NewSession(backend, data):
for (conf_name, data_name) in (
("fetch_size", "fetchSize"),
("impersonated_user", "impersonatedUser"),
("ignore_bookmark_manager", "ignoreBookmarkManager"),
):
if data_name in data:
config[conf_name] = data[data_name]
Expand Down
1 change: 0 additions & 1 deletion testkitbackend/_sync/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ def NewSession(backend, data):
for (conf_name, data_name) in (
("fetch_size", "fetchSize"),
("impersonated_user", "impersonatedUser"),
("ignore_bookmark_manager", "ignoreBookmarkManager"),
):
if data_name in data:
config[conf_name] = data[data_name]
Expand Down
13 changes: 0 additions & 13 deletions tests/unit/async_/work/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,16 +484,3 @@ async def bmm_gat_all_bookmarks():

assert last_bookmarks.raw_values == {"session", "bookmarks"}
assert last_bookmarks.raw_values == {"session", "bookmarks"}


@mark_async_test
async def test_with_ignored_bookmark_manager(fake_pool, mocker):
bmm = mocker.Mock(spec=AsyncBookmarkManager)
session_config = SessionConfig()
session_config.bookmark_manager = bmm
session_config.ignore_bookmark_manager = True
async with AsyncSession(fake_pool, session_config) as session:
await session.run("RETURN 1")

bmm.assert_not_called()
assert not bmm.method_calls
1 change: 0 additions & 1 deletion tests/unit/common/test_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
"impersonated_user": None,
"fetch_size": 100,
"bookmark_manager": object(),
"ignore_bookmark_manager": False,
}


Expand Down
13 changes: 0 additions & 13 deletions tests/unit/sync/work/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,16 +484,3 @@ def bmm_gat_all_bookmarks():

assert last_bookmarks.raw_values == {"session", "bookmarks"}
assert last_bookmarks.raw_values == {"session", "bookmarks"}


@mark_sync_test
def test_with_ignored_bookmark_manager(fake_pool, mocker):
bmm = mocker.Mock(spec=BookmarkManager)
session_config = SessionConfig()
session_config.bookmark_manager = bmm
session_config.ignore_bookmark_manager = True
with Session(fake_pool, session_config) as session:
session.run("RETURN 1")

bmm.assert_not_called()
assert not bmm.method_calls