diff --git a/docs/source/api.rst b/docs/source/api.rst index 24f12de56..960f25e71 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -280,11 +280,6 @@ Closing a driver will immediately shut down all connections in the pool. By default, the driver configuration is used. - **This is a preview** (see :ref:`filter-warnings-ref`). - It might be changed without following the deprecation policy. - See also - https://github.com/neo4j/neo4j-python-driver/wiki/preview-features - See also the Session config :ref:`session-auth-ref`. :type auth_: typing.Tuple[typing.Any, typing.Any] | Auth | None :param result_transformer_: @@ -374,9 +369,12 @@ Closing a driver will immediately shut down all connections in the pool. .. versionchanged:: 5.8 - * Added the ``auth_`` parameter. + * Added ``auth_`` parameter in preview. * Stabilized from experimental. + .. versionchanged:: 5.14 + Stabilized ``auth_`` parameter from preview. + .. _driver-configuration-ref: @@ -1044,7 +1042,7 @@ See :class:`.BookmarkManager` for more information. .. versionadded:: 5.0 -.. versionchanged:: 5.8 stabilized from experimental +.. versionchanged:: 5.8 Stabilized from experimental. .. _session-auth-ref: @@ -1060,15 +1058,13 @@ It is not possible to overwrite the authentication information for the session w i.e., downgrade the authentication at session level. Instead, you should create a driver with no authentication and upgrade the authentication at session level as needed. -**This is a preview** (see :ref:`filter-warnings-ref`). -It might be changed without following the deprecation policy. -See also https://github.com/neo4j/neo4j-python-driver/wiki/preview-features - :Type: :data:`None`, :class:`.Auth` or ``(user, password)``-tuple :Default: :data:`None` - use the authentication information provided during driver creation. .. versionadded:: 5.8 +.. versionchanged:: 5.14 Stabilized from preview. + .. _session-notifications-min-severity-ref: diff --git a/docs/source/async_api.rst b/docs/source/async_api.rst index aa1cb2224..5518628e8 100644 --- a/docs/source/async_api.rst +++ b/docs/source/async_api.rst @@ -267,11 +267,6 @@ Closing a driver will immediately shut down all connections in the pool. By default, the driver configuration is used. - **This is a preview** (see :ref:`filter-warnings-ref`). - It might be changed without following the deprecation policy. - See also - https://github.com/neo4j/neo4j-python-driver/wiki/preview-features - See also the Session config :ref:`session-auth-ref`. :type auth_: typing.Tuple[typing.Any, typing.Any] | Auth | None :param result_transformer_: @@ -361,9 +356,12 @@ Closing a driver will immediately shut down all connections in the pool. .. versionchanged:: 5.8 - * Added the ``auth_`` parameter. + * Added ``auth_`` parameter in preview. * Stabilized from experimental. + .. versionchanged:: 5.14 + Stabilized ``auth_`` parameter from preview. + .. _async-driver-configuration-ref: @@ -651,7 +649,7 @@ See :class:`BookmarkManager` for more information. :Type: :data:`None`, :class:`BookmarkManager`, or :class:`AsyncBookmarkManager` :Default: :data:`None` -.. versionchanged:: 5.8 stabilized from experimental +.. versionchanged:: 5.8 Stabilized from experimental. diff --git a/src/neo4j/_api.py b/src/neo4j/_api.py index 55d3f2c68..45664de08 100644 --- a/src/neo4j/_api.py +++ b/src/neo4j/_api.py @@ -229,8 +229,8 @@ class RoutingControl(str, Enum): .. versionchanged:: 5.8 - * renamed ``READERS`` to ``READ`` and ``WRITERS`` to ``WRITE`` - * stabilized from experimental + * Renamed ``READERS`` to ``READ`` and ``WRITERS`` to ``WRITE``. + * Stabilized from experimental. """ READ = "r" WRITE = "w" diff --git a/src/neo4j/_async/auth_management.py b/src/neo4j/_async/auth_management.py index 491de1627..e11854202 100644 --- a/src/neo4j/_async/auth_management.py +++ b/src/neo4j/_async/auth_management.py @@ -27,7 +27,6 @@ expiring_auth_has_expired, ExpiringAuth, ) -from .._meta import preview if t.TYPE_CHECKING: @@ -105,20 +104,17 @@ async def handle_security_exception( class AsyncAuthManagers: """A collection of :class:`.AsyncAuthManager` factories. - **This is a preview** (see :ref:`filter-warnings-ref`). - It might be changed without following the deprecation policy. - See also https://github.com/neo4j/neo4j-python-driver/wiki/preview-features - .. versionadded:: 5.8 .. versionchanged:: 5.12 * Method ``expiration_based()`` was renamed to :meth:`bearer`. * Added :meth:`basic`. + + .. versionchanged:: 5.14 Stabilized from preview. """ @staticmethod - @preview("Auth managers are a preview feature.") def static(auth: _TAuth) -> AsyncAuthManager: """Create a static auth manager. @@ -146,11 +142,14 @@ def static(auth: _TAuth) -> AsyncAuthManager: :returns: An instance of an implementation of :class:`.AsyncAuthManager` that always returns the same auth. + + .. versionadded:: 5.8 + + .. versionchanged:: 5.14 Stabilized from preview. """ return AsyncStaticAuthManager(auth) @staticmethod - @preview("Auth managers are a preview feature.") def basic( provider: t.Callable[[], t.Awaitable[_TAuth]] ) -> AsyncAuthManager: @@ -203,18 +202,17 @@ async def auth_provider(): flagged it as expired). .. versionadded:: 5.12 + + .. versionchanged:: 5.14 Stabilized from preview. """ handled_codes = frozenset(("Neo.ClientError.Security.Unauthorized",)) async def wrapped_provider() -> ExpiringAuth: - return ExpiringAuth._without_warning( # type: ignore - await provider() - ) + return ExpiringAuth(await provider()) return AsyncNeo4jAuthTokenManager(wrapped_provider, handled_codes) @staticmethod - @preview("Auth managers are a preview feature.") def bearer( provider: t.Callable[[], t.Awaitable[ExpiringAuth]] ) -> AsyncAuthManager: @@ -277,6 +275,8 @@ async def auth_provider(): expired). .. versionadded:: 5.12 + + .. versionchanged:: 5.14 Stabilized from preview. """ handled_codes = frozenset(( "Neo.ClientError.Security.TokenExpired", diff --git a/src/neo4j/_async/driver.py b/src/neo4j/_async/driver.py index de5e8bb28..f1e84a8f6 100644 --- a/src/neo4j/_async/driver.py +++ b/src/neo4j/_async/driver.py @@ -47,8 +47,6 @@ from .._meta import ( deprecation_warn, experimental_warn, - preview, - preview_warn, unclosed_resource_warn, ) from .._work import EagerResult @@ -193,10 +191,7 @@ def driver( driver_type, security_type, parsed = parse_neo4j_uri(uri) if not isinstance(auth, AsyncAuthManager): - auth = AsyncAuthManagers.static._without_warning(auth) - else: - preview_warn("Auth managers are a preview feature.", - stack_level=2) + auth = AsyncAuthManagers.static(auth) config["auth"] = auth # TODO: 6.0 - remove "trust" config option @@ -357,7 +352,7 @@ def bookmark_manager( * ``bookmarks_consumer`` no longer receives the database name as an argument. - .. versionchanged:: 5.8 stabilized from experimental + .. versionchanged:: 5.8 Stabilized from experimental. """ return AsyncNeo4jBookmarkManager( initial_bookmarks=initial_bookmarks, @@ -551,17 +546,14 @@ def session(self, **config) -> AsyncSession: def _session(self, session_config) -> AsyncSession: return AsyncSession(self._pool, session_config) - def _read_session_config(self, config_kwargs, preview_check=True): - config = self._prepare_session_config(preview_check, config_kwargs) + def _read_session_config(self, config_kwargs): + config = self._prepare_session_config(config_kwargs) session_config = SessionConfig(self._default_workspace_config, config) return session_config @classmethod - def _prepare_session_config(cls, preview_check, config_kwargs): - if preview_check and "auth" in config_kwargs: - preview_warn("User switching is a preview feature.", - stack_level=5) + def _prepare_session_config(cls, config_kwargs): _normalize_notifications_config(config_kwargs) return config_kwargs @@ -745,11 +737,6 @@ async def example(driver: neo4j.AsyncDriver) -> int: By default, the driver configuration is used. - **This is a preview** (see :ref:`filter-warnings-ref`). - It might be changed without following the deprecation policy. - See also - https://github.com/neo4j/neo4j-python-driver/wiki/preview-features - See also the Session config :ref:`session-auth-ref`. :type auth_: typing.Tuple[typing.Any, typing.Any] | Auth | None :param result_transformer_: @@ -839,8 +826,11 @@ async def example(driver: neo4j.AsyncDriver) -> neo4j.Record:: .. versionchanged:: 5.8 - * Added the ``auth_`` parameter. + * Added ``auth_`` parameter in preview. * Stabilized from experimental. + + .. versionchanged:: 5.14 + Stabilized ``auth_`` parameter from preview. """ self._check_state() invalid_kwargs = [k for k in kwargs if @@ -865,8 +855,7 @@ async def example(driver: neo4j.AsyncDriver) -> neo4j.Record:: "impersonated_user": impersonated_user_, "bookmark_manager": bookmark_manager_, "auth": auth_, - }, - preview_check=False + } ) session = self._session(session_config) async with session: @@ -1072,7 +1061,7 @@ async def supports_multi_db(self) -> bool: driver feature. """ self._check_state() - session_config = self._read_session_config({}, preview_check=False) + session_config = self._read_session_config({}) async with self._session(session_config) as session: await session._connect(READ_ACCESS) assert session._connection @@ -1106,7 +1095,6 @@ async def verify_authentication( else: - @preview("User switching is a preview feature.") async def verify_authentication( self, auth: t.Union[Auth, t.Tuple[t.Any, t.Any], None] = None, @@ -1140,12 +1128,9 @@ async def verify_authentication( Use the exception to further understand the cause of the connectivity problem. - **This is a preview** (see :ref:`filter-warnings-ref`). - It might be changed without following the deprecation policy. - See also - https://github.com/neo4j/neo4j-python-driver/wiki/preview-features - .. versionadded:: 5.8 + + .. versionchanged:: 5.14 Stabilized from experimental. """ self._check_state() if config: @@ -1190,7 +1175,7 @@ async def supports_session_auth(self) -> bool: .. versionadded:: 5.8 """ self._check_state() - session_config = self._read_session_config({}, preview_check=False) + session_config = self._read_session_config({}) async with self._session(session_config) as session: await session._connect(READ_ACCESS) assert session._connection diff --git a/src/neo4j/_async/work/result.py b/src/neo4j/_async/work/result.py index 9e1b5c786..8fb202af8 100644 --- a/src/neo4j/_async/work/result.py +++ b/src/neo4j/_async/work/result.py @@ -642,7 +642,7 @@ async def to_eager_result(self) -> EagerResult: .. versionadded:: 5.5 - .. versionchanged:: 5.8 stabilized from experimental + .. versionchanged:: 5.8 Stabilized from experimental. """ await self._buffer_all() diff --git a/src/neo4j/_async/work/session.py b/src/neo4j/_async/work/session.py index fb3233157..4dd4bfef5 100644 --- a/src/neo4j/_async/work/session.py +++ b/src/neo4j/_async/work/session.py @@ -105,9 +105,7 @@ class AsyncSession(AsyncWorkspace): def __init__(self, pool, session_config): assert isinstance(session_config, SessionConfig) if session_config.auth is not None: - session_config.auth = AsyncAuthManagers.static._without_warning( - session_config.auth - ) + session_config.auth = AsyncAuthManagers.static(session_config.auth) super().__init__(pool, session_config) self._config = session_config self._initialize_bookmarks(session_config.bookmarks) diff --git a/src/neo4j/_auth_management.py b/src/neo4j/_auth_management.py index b846e4882..aa0fa1b9f 100644 --- a/src/neo4j/_auth_management.py +++ b/src/neo4j/_auth_management.py @@ -23,7 +23,6 @@ import typing as t from dataclasses import dataclass -from ._meta import preview from .exceptions import Neo4jError @@ -31,7 +30,6 @@ from .api import _TAuth -@preview("Auth managers are a preview feature.") @dataclass class ExpiringAuth: """Represents potentially expiring authentication information. @@ -46,10 +44,6 @@ class ExpiringAuth: If :data:`None`, the authentication information is considered to not expire until the server explicitly indicates so. - **This is a preview** (see :ref:`filter-warnings-ref`). - It might be changed without following the deprecation policy. - See also https://github.com/neo4j/neo4j-python-driver/wiki/preview-features - .. seealso:: :meth:`.AuthManagers.expiration_based`, :meth:`.AsyncAuthManagers.expiration_based` @@ -57,10 +51,13 @@ class ExpiringAuth: .. versionadded:: 5.8 .. versionchanged:: 5.9 - Removed parameter and attribute ``expires_in`` (relative expiration - time). Replaced with ``expires_at`` (absolute expiration time). - :meth:`.expires_in` can be used to create an :class:`.ExpiringAuth` - with a relative expiration time. + + * Removed parameter and attribute ``expires_in`` (relative expiration + time). Replaced with ``expires_at`` (absolute expiration time). + * :meth:`.expires_in` can be used to create an :class:`.ExpiringAuth` + with a relative expiration time. + + .. versionchanged:: 5.14 Stabilized from preview. """ auth: _TAuth expires_at: t.Optional[float] = None @@ -85,9 +82,7 @@ def expires_in(self, seconds: float) -> ExpiringAuth: .. versionadded:: 5.9 """ - return ExpiringAuth._without_warning( # type: ignore - self.auth, time.time() + seconds - ) + return ExpiringAuth(self.auth, time.time() + seconds) def expiring_auth_has_expired(auth: ExpiringAuth) -> bool: @@ -116,19 +111,15 @@ class AuthManager(metaclass=abc.ABCMeta): You may use session-level authentication for such use-cases :ref:`session-auth-ref`. - **This is a preview** (see :ref:`filter-warnings-ref`). - It might be changed without following the deprecation policy. - See also https://github.com/neo4j/neo4j-python-driver/wiki/preview-features - .. seealso:: :class:`.AuthManagers` .. versionadded:: 5.8 .. versionchanged:: 5.12 ``on_auth_expired`` was removed from the interface and replaced by - :meth:`handle_security_exception`. The new method is called when the + :meth:`handle_security_exception`. The new method is called when the server returns any `Neo.ClientError.Security.*` error. It's signature - differs in that it additionally received the error returned by the + differs in that it additionally receives the error returned by the server and returns a boolean indicating whether the error was handled. """ @@ -178,10 +169,6 @@ def handle_security_exception( class AsyncAuthManager(metaclass=abc.ABCMeta): """Async version of :class:`.AuthManager`. - **This is a preview** (see :ref:`filter-warnings-ref`). - It might be changed without following the deprecation policy. - See also https://github.com/neo4j/neo4j-python-driver/wiki/preview-features - .. seealso:: :class:`.AuthManager` .. versionadded:: 5.8 diff --git a/src/neo4j/_sync/auth_management.py b/src/neo4j/_sync/auth_management.py index 14e09d121..63b631a76 100644 --- a/src/neo4j/_sync/auth_management.py +++ b/src/neo4j/_sync/auth_management.py @@ -27,7 +27,6 @@ expiring_auth_has_expired, ExpiringAuth, ) -from .._meta import preview if t.TYPE_CHECKING: @@ -105,20 +104,17 @@ def handle_security_exception( class AuthManagers: """A collection of :class:`.AuthManager` factories. - **This is a preview** (see :ref:`filter-warnings-ref`). - It might be changed without following the deprecation policy. - See also https://github.com/neo4j/neo4j-python-driver/wiki/preview-features - .. versionadded:: 5.8 .. versionchanged:: 5.12 * Method ``expiration_based()`` was renamed to :meth:`bearer`. * Added :meth:`basic`. + + .. versionchanged:: 5.14 Stabilized from preview. """ @staticmethod - @preview("Auth managers are a preview feature.") def static(auth: _TAuth) -> AuthManager: """Create a static auth manager. @@ -146,11 +142,14 @@ def static(auth: _TAuth) -> AuthManager: :returns: An instance of an implementation of :class:`.AuthManager` that always returns the same auth. + + .. versionadded:: 5.8 + + .. versionchanged:: 5.14 Stabilized from preview. """ return StaticAuthManager(auth) @staticmethod - @preview("Auth managers are a preview feature.") def basic( provider: t.Callable[[], t.Union[_TAuth]] ) -> AuthManager: @@ -203,18 +202,17 @@ def auth_provider(): flagged it as expired). .. versionadded:: 5.12 + + .. versionchanged:: 5.14 Stabilized from preview. """ handled_codes = frozenset(("Neo.ClientError.Security.Unauthorized",)) def wrapped_provider() -> ExpiringAuth: - return ExpiringAuth._without_warning( # type: ignore - provider() - ) + return ExpiringAuth(provider()) return Neo4jAuthTokenManager(wrapped_provider, handled_codes) @staticmethod - @preview("Auth managers are a preview feature.") def bearer( provider: t.Callable[[], t.Union[ExpiringAuth]] ) -> AuthManager: @@ -277,6 +275,8 @@ def auth_provider(): expired). .. versionadded:: 5.12 + + .. versionchanged:: 5.14 Stabilized from preview. """ handled_codes = frozenset(( "Neo.ClientError.Security.TokenExpired", diff --git a/src/neo4j/_sync/driver.py b/src/neo4j/_sync/driver.py index 7e18adf2a..79ae9da8e 100644 --- a/src/neo4j/_sync/driver.py +++ b/src/neo4j/_sync/driver.py @@ -47,8 +47,6 @@ from .._meta import ( deprecation_warn, experimental_warn, - preview, - preview_warn, unclosed_resource_warn, ) from .._work import EagerResult @@ -192,10 +190,7 @@ def driver( driver_type, security_type, parsed = parse_neo4j_uri(uri) if not isinstance(auth, AuthManager): - auth = AuthManagers.static._without_warning(auth) - else: - preview_warn("Auth managers are a preview feature.", - stack_level=2) + auth = AuthManagers.static(auth) config["auth"] = auth # TODO: 6.0 - remove "trust" config option @@ -356,7 +351,7 @@ def bookmark_manager( * ``bookmarks_consumer`` no longer receives the database name as an argument. - .. versionchanged:: 5.8 stabilized from experimental + .. versionchanged:: 5.8 Stabilized from experimental. """ return Neo4jBookmarkManager( initial_bookmarks=initial_bookmarks, @@ -550,17 +545,14 @@ def session(self, **config) -> Session: def _session(self, session_config) -> Session: return Session(self._pool, session_config) - def _read_session_config(self, config_kwargs, preview_check=True): - config = self._prepare_session_config(preview_check, config_kwargs) + def _read_session_config(self, config_kwargs): + config = self._prepare_session_config(config_kwargs) session_config = SessionConfig(self._default_workspace_config, config) return session_config @classmethod - def _prepare_session_config(cls, preview_check, config_kwargs): - if preview_check and "auth" in config_kwargs: - preview_warn("User switching is a preview feature.", - stack_level=5) + def _prepare_session_config(cls, config_kwargs): _normalize_notifications_config(config_kwargs) return config_kwargs @@ -744,11 +736,6 @@ def example(driver: neo4j.Driver) -> int: By default, the driver configuration is used. - **This is a preview** (see :ref:`filter-warnings-ref`). - It might be changed without following the deprecation policy. - See also - https://github.com/neo4j/neo4j-python-driver/wiki/preview-features - See also the Session config :ref:`session-auth-ref`. :type auth_: typing.Tuple[typing.Any, typing.Any] | Auth | None :param result_transformer_: @@ -838,8 +825,11 @@ def example(driver: neo4j.Driver) -> neo4j.Record:: .. versionchanged:: 5.8 - * Added the ``auth_`` parameter. + * Added ``auth_`` parameter in preview. * Stabilized from experimental. + + .. versionchanged:: 5.14 + Stabilized ``auth_`` parameter from preview. """ self._check_state() invalid_kwargs = [k for k in kwargs if @@ -864,8 +854,7 @@ def example(driver: neo4j.Driver) -> neo4j.Record:: "impersonated_user": impersonated_user_, "bookmark_manager": bookmark_manager_, "auth": auth_, - }, - preview_check=False + } ) session = self._session(session_config) with session: @@ -1071,7 +1060,7 @@ def supports_multi_db(self) -> bool: driver feature. """ self._check_state() - session_config = self._read_session_config({}, preview_check=False) + session_config = self._read_session_config({}) with self._session(session_config) as session: session._connect(READ_ACCESS) assert session._connection @@ -1105,7 +1094,6 @@ def verify_authentication( else: - @preview("User switching is a preview feature.") def verify_authentication( self, auth: t.Union[Auth, t.Tuple[t.Any, t.Any], None] = None, @@ -1139,12 +1127,9 @@ def verify_authentication( Use the exception to further understand the cause of the connectivity problem. - **This is a preview** (see :ref:`filter-warnings-ref`). - It might be changed without following the deprecation policy. - See also - https://github.com/neo4j/neo4j-python-driver/wiki/preview-features - .. versionadded:: 5.8 + + .. versionchanged:: 5.14 Stabilized from experimental. """ self._check_state() if config: @@ -1189,7 +1174,7 @@ def supports_session_auth(self) -> bool: .. versionadded:: 5.8 """ self._check_state() - session_config = self._read_session_config({}, preview_check=False) + session_config = self._read_session_config({}) with self._session(session_config) as session: session._connect(READ_ACCESS) assert session._connection diff --git a/src/neo4j/_sync/work/result.py b/src/neo4j/_sync/work/result.py index b2a079962..479d9dee1 100644 --- a/src/neo4j/_sync/work/result.py +++ b/src/neo4j/_sync/work/result.py @@ -642,7 +642,7 @@ def to_eager_result(self) -> EagerResult: .. versionadded:: 5.5 - .. versionchanged:: 5.8 stabilized from experimental + .. versionchanged:: 5.8 Stabilized from experimental. """ self._buffer_all() diff --git a/src/neo4j/_sync/work/session.py b/src/neo4j/_sync/work/session.py index 8869078bf..d6b57240d 100644 --- a/src/neo4j/_sync/work/session.py +++ b/src/neo4j/_sync/work/session.py @@ -105,9 +105,7 @@ class Session(Workspace): def __init__(self, pool, session_config): assert isinstance(session_config, SessionConfig) if session_config.auth is not None: - session_config.auth = AuthManagers.static._without_warning( - session_config.auth - ) + session_config.auth = AuthManagers.static(session_config.auth) super().__init__(pool, session_config) self._config = session_config self._initialize_bookmarks(session_config.bookmarks) diff --git a/src/neo4j/_work/eager_result.py b/src/neo4j/_work/eager_result.py index 5e7aaa248..f93c60db4 100644 --- a/src/neo4j/_work/eager_result.py +++ b/src/neo4j/_work/eager_result.py @@ -42,7 +42,7 @@ class EagerResult(t.NamedTuple): .. versionadded:: 5.5 - .. versionchanged:: 5.8 stabilized from experimental + .. versionchanged:: 5.8 Stabilized from experimental. """ #: Alias for field 0 (``eager_result[0]``) records: t.List[Record] diff --git a/src/neo4j/api.py b/src/neo4j/api.py index 3b3d42ddf..8098ed1d8 100644 --- a/src/neo4j/api.py +++ b/src/neo4j/api.py @@ -423,7 +423,7 @@ class BookmarkManager(_Protocol, metaclass=abc.ABCMeta): * The ``get_all_bookmarks`` method was removed. * The ``forget`` method was removed. - .. versionchanged:: 5.8 stabilized from experimental + .. versionchanged:: 5.8 Stabilized from experimental. """ @abc.abstractmethod @@ -460,7 +460,7 @@ class AsyncBookmarkManager(_Protocol, metaclass=abc.ABCMeta): .. versionchanged:: 5.3 See :class:`.BookmarkManager` for changes. - .. versionchanged:: 5.8 stabilized from experimental + .. versionchanged:: 5.8 Stabilized from experimental. """ @abc.abstractmethod diff --git a/testkitbackend/_async/requests.py b/testkitbackend/_async/requests.py index 2038c8baa..853d5d7a0 100644 --- a/testkitbackend/_async/requests.py +++ b/testkitbackend/_async/requests.py @@ -107,12 +107,8 @@ async def GetFeatures(backend, data): async def NewDriver(backend, data): auth = fromtestkit.to_auth_token(data, "authorizationToken") - expected_warnings = [] if auth is None and data.get("authTokenManagerId") is not None: auth = backend.auth_token_managers[data["authTokenManagerId"]] - expected_warnings.append( - (neo4j.PreviewWarning, "Auth managers are a preview feature.") - ) else: data.mark_item_as_read_if_equals("authTokenManagerId", None) kwargs = {} @@ -155,15 +151,9 @@ async def NewDriver(backend, data): fromtestkit.set_notifications_config(kwargs, data) data.mark_item_as_read_if_equals("livenessCheckTimeoutMs", None) - if expected_warnings: - with warnings_check(expected_warnings): - driver = neo4j.AsyncGraphDatabase.driver( - data["uri"], auth=auth, user_agent=data["userAgent"], **kwargs, - ) - else: - driver = neo4j.AsyncGraphDatabase.driver( - data["uri"], auth=auth, user_agent=data["userAgent"], **kwargs, - ) + driver = neo4j.AsyncGraphDatabase.driver( + data["uri"], auth=auth, user_agent=data["userAgent"], **kwargs, + ) key = backend.next_key() backend.drivers[key] = driver await backend.send_response("Driver", {"id": key}) @@ -260,9 +250,7 @@ async def auth_token_provider(): ) return backend.basic_auth_token_supplies.pop(key) - with warning_check(neo4j.PreviewWarning, - "Auth managers are a preview feature."): - auth_manager = AsyncAuthManagers.basic(auth_token_provider) + auth_manager = AsyncAuthManagers.basic(auth_token_provider) backend.auth_token_managers[auth_token_manager_id] = auth_manager await backend.send_response( "BasicAuthTokenManager", {"id": auth_token_manager_id} @@ -297,9 +285,7 @@ async def auth_token_provider(): ) return backend.expiring_auth_token_supplies.pop(key) - with warning_check(neo4j.PreviewWarning, - "Auth managers are a preview feature."): - auth_manager = AsyncAuthManagers.bearer(auth_token_provider) + auth_manager = AsyncAuthManagers.bearer(auth_token_provider) backend.auth_token_managers[auth_token_manager_id] = auth_manager await backend.send_response( "BearerAuthTokenManager", {"id": auth_token_manager_id} @@ -312,9 +298,7 @@ async def BearerAuthTokenProviderCompleted(backend, data): "AuthTokenAndExpiration") temp_auth_data = temp_auth_data["data"] auth_token = fromtestkit.to_auth_token(temp_auth_data, "auth") - with warning_check(neo4j.PreviewWarning, - "Auth managers are a preview feature."): - expiring_auth = ExpiringAuth(auth_token) + expiring_auth = ExpiringAuth(auth_token) if temp_auth_data["expiresInMs"] is not None: expires_in = temp_auth_data["expiresInMs"] / 1000 expiring_auth = expiring_auth.expires_in(expires_in) @@ -353,9 +337,7 @@ async def VerifyAuthentication(backend, data): driver_id = data["driverId"] driver = backend.drivers[driver_id] auth = fromtestkit.to_auth_token(data, "authorizationToken") - with warning_check(neo4j.PreviewWarning, - "User switching is a preview feature."): - authenticated = await driver.verify_authentication(auth=auth) + authenticated = await driver.verify_authentication(auth=auth) await backend.send_response("DriverIsAuthenticated", { "id": backend.next_key(), "authenticated": authenticated }) @@ -564,7 +546,6 @@ def __init__(self, session): async def NewSession(backend, data): driver = backend.drivers[data["driverId"]] - expected_warnings = [] config = { "database": data["database"], } @@ -592,15 +573,8 @@ async def NewSession(backend, data): config[conf_name] = data[data_name] if data.get("authorizationToken"): config["auth"] = fromtestkit.to_auth_token(data, "authorizationToken") - expected_warnings.append( - (neo4j.PreviewWarning, "User switching is a preview feature.") - ) fromtestkit.set_notifications_config(config, data) - if expected_warnings: - with warnings_check(expected_warnings): - session = driver.session(**config) - else: - session = driver.session(**config) + session = driver.session(**config) key = backend.next_key() backend.sessions[key] = SessionTracker(session) await backend.send_response("Session", {"id": key}) diff --git a/testkitbackend/_sync/requests.py b/testkitbackend/_sync/requests.py index efaec61bb..620ca476b 100644 --- a/testkitbackend/_sync/requests.py +++ b/testkitbackend/_sync/requests.py @@ -107,12 +107,8 @@ def GetFeatures(backend, data): def NewDriver(backend, data): auth = fromtestkit.to_auth_token(data, "authorizationToken") - expected_warnings = [] if auth is None and data.get("authTokenManagerId") is not None: auth = backend.auth_token_managers[data["authTokenManagerId"]] - expected_warnings.append( - (neo4j.PreviewWarning, "Auth managers are a preview feature.") - ) else: data.mark_item_as_read_if_equals("authTokenManagerId", None) kwargs = {} @@ -155,15 +151,9 @@ def NewDriver(backend, data): fromtestkit.set_notifications_config(kwargs, data) data.mark_item_as_read_if_equals("livenessCheckTimeoutMs", None) - if expected_warnings: - with warnings_check(expected_warnings): - driver = neo4j.GraphDatabase.driver( - data["uri"], auth=auth, user_agent=data["userAgent"], **kwargs, - ) - else: - driver = neo4j.GraphDatabase.driver( - data["uri"], auth=auth, user_agent=data["userAgent"], **kwargs, - ) + driver = neo4j.GraphDatabase.driver( + data["uri"], auth=auth, user_agent=data["userAgent"], **kwargs, + ) key = backend.next_key() backend.drivers[key] = driver backend.send_response("Driver", {"id": key}) @@ -260,9 +250,7 @@ def auth_token_provider(): ) return backend.basic_auth_token_supplies.pop(key) - with warning_check(neo4j.PreviewWarning, - "Auth managers are a preview feature."): - auth_manager = AuthManagers.basic(auth_token_provider) + auth_manager = AuthManagers.basic(auth_token_provider) backend.auth_token_managers[auth_token_manager_id] = auth_manager backend.send_response( "BasicAuthTokenManager", {"id": auth_token_manager_id} @@ -297,9 +285,7 @@ def auth_token_provider(): ) return backend.expiring_auth_token_supplies.pop(key) - with warning_check(neo4j.PreviewWarning, - "Auth managers are a preview feature."): - auth_manager = AuthManagers.bearer(auth_token_provider) + auth_manager = AuthManagers.bearer(auth_token_provider) backend.auth_token_managers[auth_token_manager_id] = auth_manager backend.send_response( "BearerAuthTokenManager", {"id": auth_token_manager_id} @@ -312,9 +298,7 @@ def BearerAuthTokenProviderCompleted(backend, data): "AuthTokenAndExpiration") temp_auth_data = temp_auth_data["data"] auth_token = fromtestkit.to_auth_token(temp_auth_data, "auth") - with warning_check(neo4j.PreviewWarning, - "Auth managers are a preview feature."): - expiring_auth = ExpiringAuth(auth_token) + expiring_auth = ExpiringAuth(auth_token) if temp_auth_data["expiresInMs"] is not None: expires_in = temp_auth_data["expiresInMs"] / 1000 expiring_auth = expiring_auth.expires_in(expires_in) @@ -353,9 +337,7 @@ def VerifyAuthentication(backend, data): driver_id = data["driverId"] driver = backend.drivers[driver_id] auth = fromtestkit.to_auth_token(data, "authorizationToken") - with warning_check(neo4j.PreviewWarning, - "User switching is a preview feature."): - authenticated = driver.verify_authentication(auth=auth) + authenticated = driver.verify_authentication(auth=auth) backend.send_response("DriverIsAuthenticated", { "id": backend.next_key(), "authenticated": authenticated }) @@ -564,7 +546,6 @@ def __init__(self, session): def NewSession(backend, data): driver = backend.drivers[data["driverId"]] - expected_warnings = [] config = { "database": data["database"], } @@ -592,15 +573,8 @@ def NewSession(backend, data): config[conf_name] = data[data_name] if data.get("authorizationToken"): config["auth"] = fromtestkit.to_auth_token(data, "authorizationToken") - expected_warnings.append( - (neo4j.PreviewWarning, "User switching is a preview feature.") - ) fromtestkit.set_notifications_config(config, data) - if expected_warnings: - with warnings_check(expected_warnings): - session = driver.session(**config) - else: - session = driver.session(**config) + session = driver.session(**config) key = backend.next_key() backend.sessions[key] = SessionTracker(session) backend.send_response("Session", {"id": key}) diff --git a/tests/unit/async_/io/conftest.py b/tests/unit/async_/io/conftest.py index 314e69d3a..c418c8c85 100644 --- a/tests/unit/async_/io/conftest.py +++ b/tests/unit/async_/io/conftest.py @@ -24,7 +24,6 @@ import pytest -from neo4j import PreviewWarning from neo4j._async.io._common import ( AsyncInbox, AsyncOutbox, @@ -148,13 +147,10 @@ def fake_socket_2(): def fake_socket_pair(): return AsyncFakeSocketPair + @pytest.fixture def static_auth(): - def inner(auth): - with pytest.warns(PreviewWarning, match="Auth managers"): - return AsyncAuthManagers.static(auth) - - return inner + return AsyncAuthManagers.static @pytest.fixture diff --git a/tests/unit/async_/io/test_direct.py b/tests/unit/async_/io/test_direct.py index 21bdd8d6d..e9007d9f1 100644 --- a/tests/unit/async_/io/test_direct.py +++ b/tests/unit/async_/io/test_direct.py @@ -19,7 +19,6 @@ import pytest import neo4j -from neo4j import PreviewWarning from neo4j._async.io import AsyncBolt from neo4j._async.io._pool import AsyncIOPool from neo4j._conf import ( @@ -110,14 +109,16 @@ async def acquire( self.address, auth, timeout, liveness_check_timeout ) + def static_auth(auth): - with pytest.warns(PreviewWarning, match="Auth managers"): - return AsyncAuthManagers.static(auth) + return AsyncAuthManagers.static(auth) + @pytest.fixture def auth_manager(): static_auth(("test", "test")) + @mark_async_test async def test_bolt_connection_open(auth_manager): with pytest.raises(ServiceUnavailable): diff --git a/tests/unit/async_/io/test_neo4j_pool.py b/tests/unit/async_/io/test_neo4j_pool.py index 433ad5002..ac98e9b08 100644 --- a/tests/unit/async_/io/test_neo4j_pool.py +++ b/tests/unit/async_/io/test_neo4j_pool.py @@ -114,8 +114,7 @@ def _pool_config(): def _auth_manager(auth): - with pytest.warns(PreviewWarning, match="Auth managers"): - return AsyncAuthManagers.static(auth) + return AsyncAuthManagers.static(auth) def _simple_pool(opener) -> AsyncNeo4jPool: diff --git a/tests/unit/async_/test_auth_manager.py b/tests/unit/async_/test_auth_manager.py index 6a1fdbcb6..5504a14e5 100644 --- a/tests/unit/async_/test_auth_manager.py +++ b/tests/unit/async_/test_auth_manager.py @@ -74,26 +74,22 @@ @copy_signature(AsyncAuthManagers.static) def static_auth_manager(*args, **kwargs): - with pytest.warns(PreviewWarning, match="Auth managers"): - return AsyncAuthManagers.static(*args, **kwargs) + return AsyncAuthManagers.static(*args, **kwargs) @copy_signature(AsyncAuthManagers.basic) def basic_auth_manager(*args, **kwargs): - with pytest.warns(PreviewWarning, match="Auth managers"): - return AsyncAuthManagers.basic(*args, **kwargs) + return AsyncAuthManagers.basic(*args, **kwargs) @copy_signature(AsyncAuthManagers.bearer) def bearer_auth_manager(*args, **kwargs): - with pytest.warns(PreviewWarning, match="Auth managers"): - return AsyncAuthManagers.bearer(*args, **kwargs) + return AsyncAuthManagers.bearer(*args, **kwargs) @copy_signature(ExpiringAuth) def expiring_auth(*args, **kwargs): - with pytest.warns(PreviewWarning, match="Auth managers"): - return ExpiringAuth(*args, **kwargs) + return ExpiringAuth(*args, **kwargs) @mark_async_test diff --git a/tests/unit/sync/io/conftest.py b/tests/unit/sync/io/conftest.py index dc286dbd2..fa4555bdb 100644 --- a/tests/unit/sync/io/conftest.py +++ b/tests/unit/sync/io/conftest.py @@ -24,7 +24,6 @@ import pytest -from neo4j import PreviewWarning from neo4j._sync.io._common import ( Inbox, Outbox, @@ -148,13 +147,10 @@ def fake_socket_2(): def fake_socket_pair(): return FakeSocketPair + @pytest.fixture def static_auth(): - def inner(auth): - with pytest.warns(PreviewWarning, match="Auth managers"): - return AuthManagers.static(auth) - - return inner + return AuthManagers.static @pytest.fixture diff --git a/tests/unit/sync/io/test_direct.py b/tests/unit/sync/io/test_direct.py index e75aab947..738aed293 100644 --- a/tests/unit/sync/io/test_direct.py +++ b/tests/unit/sync/io/test_direct.py @@ -19,7 +19,6 @@ import pytest import neo4j -from neo4j import PreviewWarning from neo4j._conf import ( Config, PoolConfig, @@ -110,14 +109,16 @@ def acquire( self.address, auth, timeout, liveness_check_timeout ) + def static_auth(auth): - with pytest.warns(PreviewWarning, match="Auth managers"): - return AuthManagers.static(auth) + return AuthManagers.static(auth) + @pytest.fixture def auth_manager(): static_auth(("test", "test")) + @mark_sync_test def test_bolt_connection_open(auth_manager): with pytest.raises(ServiceUnavailable): diff --git a/tests/unit/sync/io/test_neo4j_pool.py b/tests/unit/sync/io/test_neo4j_pool.py index 2ee6e0d11..93b3fd8fe 100644 --- a/tests/unit/sync/io/test_neo4j_pool.py +++ b/tests/unit/sync/io/test_neo4j_pool.py @@ -114,8 +114,7 @@ def _pool_config(): def _auth_manager(auth): - with pytest.warns(PreviewWarning, match="Auth managers"): - return AuthManagers.static(auth) + return AuthManagers.static(auth) def _simple_pool(opener) -> Neo4jPool: diff --git a/tests/unit/sync/test_auth_manager.py b/tests/unit/sync/test_auth_manager.py index a96d76c46..762556e79 100644 --- a/tests/unit/sync/test_auth_manager.py +++ b/tests/unit/sync/test_auth_manager.py @@ -74,26 +74,22 @@ @copy_signature(AuthManagers.static) def static_auth_manager(*args, **kwargs): - with pytest.warns(PreviewWarning, match="Auth managers"): - return AuthManagers.static(*args, **kwargs) + return AuthManagers.static(*args, **kwargs) @copy_signature(AuthManagers.basic) def basic_auth_manager(*args, **kwargs): - with pytest.warns(PreviewWarning, match="Auth managers"): - return AuthManagers.basic(*args, **kwargs) + return AuthManagers.basic(*args, **kwargs) @copy_signature(AuthManagers.bearer) def bearer_auth_manager(*args, **kwargs): - with pytest.warns(PreviewWarning, match="Auth managers"): - return AuthManagers.bearer(*args, **kwargs) + return AuthManagers.bearer(*args, **kwargs) @copy_signature(ExpiringAuth) def expiring_auth(*args, **kwargs): - with pytest.warns(PreviewWarning, match="Auth managers"): - return ExpiringAuth(*args, **kwargs) + return ExpiringAuth(*args, **kwargs) @mark_sync_test