diff --git a/procrastinate/__init__.py b/procrastinate/__init__.py index 283d4daa9..b17d06645 100644 --- a/procrastinate/__init__.py +++ b/procrastinate/__init__.py @@ -1,5 +1,5 @@ from procrastinate import metadata as _metadata_module -from procrastinate.aiopg_connector import PostgresConnector, PostgresJobStore +from procrastinate.aiopg_connector import PostgresConnector from procrastinate.app import App from procrastinate.retry import BaseRetryStrategy, RetryStrategy @@ -7,7 +7,6 @@ "App", "BaseRetryStrategy", "PostgresConnector", - "PostgresJobStore", "RetryStrategy", ] diff --git a/procrastinate/aiopg_connector.py b/procrastinate/aiopg_connector.py index 135effd45..5071f7e5f 100644 --- a/procrastinate/aiopg_connector.py +++ b/procrastinate/aiopg_connector.py @@ -1,6 +1,5 @@ import asyncio import logging -import warnings from typing import Any, Callable, Dict, Iterable, List, NoReturn, Optional import aiopg @@ -222,13 +221,3 @@ async def _loop_notify( continue event.set() - - -def PostgresJobStore(*args, **kwargs): - message = ( - "Use procrastinate.PostgresConnector(...) " - "instead of procrastinate.PostgresJobStore(...), with the same arguments" - ) - logger.warning(f"Deprecation Warning: {message}") - warnings.warn(DeprecationWarning(message)) - return PostgresConnector(**kwargs) diff --git a/procrastinate/app.py b/procrastinate/app.py index e90bea890..e92783c85 100644 --- a/procrastinate/app.py +++ b/procrastinate/app.py @@ -1,6 +1,5 @@ import functools import logging -import warnings from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, Optional, Set from procrastinate import builtin_tasks @@ -35,11 +34,9 @@ def from_path(cls, dotted_path: str): def __init__( self, *, - connector: Optional[connector_module.BaseConnector] = None, + connector: connector_module.BaseConnector, import_paths: Optional[Iterable[str]] = None, worker_timeout: float = WORKER_TIMEOUT, - # Just for backwards compatibility - job_store: Optional[connector_module.BaseConnector] = None, ): """ Parameters @@ -47,8 +44,7 @@ def __init__( connector: Instance of a subclass of :py:class:`BaseConnector`, typically :py:class:`PostgresConnector`. It will be responsible for all - communications with the database. - Mandatory if job_store is not passed. + communications with the database. Mandatory. import_paths: List of python dotted paths of modules to import, to make sure that the workers know about all possible tasks. @@ -68,21 +64,7 @@ def __init__( this parameter. Raising this parameter can lower the rate of workers making queries to the database for requesting jobs. - job_store: - **Deprecated**: Old name of ``connector``. """ - # Compatibility - if job_store: - message = ( - "Use App(connector=procrastinate.PostgresConnector(...)) " - "instead of App(job_store=procrastinate.PostgresJobStore())" - ) - logger.warning(f"Deprecation Warning: {message}") - warnings.warn(DeprecationWarning(message)) - connector = job_store - if not connector: - raise TypeError("App() missing 1 required argument: 'connector'") - self.connector = connector self.tasks: Dict[str, "tasks.Task"] = {} self.builtin_tasks: Dict[str, "tasks.Task"] = {} diff --git a/setup.cfg b/setup.cfg index cbb770257..16eae8f14 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,7 +41,7 @@ test = pytest-mock pytest-cov pytest-click - pytest-asyncio + pytest-asyncio!=0.11.0 lint = black diff --git a/tests/unit/test_aiopg_connector.py b/tests/unit/test_aiopg_connector.py index 4532ba762..021f849e5 100644 --- a/tests/unit/test_aiopg_connector.py +++ b/tests/unit/test_aiopg_connector.py @@ -1,6 +1,5 @@ import pytest -import procrastinate from procrastinate import aiopg_connector @@ -29,10 +28,3 @@ def test_adapt_pool_args_maxsize(): ) assert args["maxsize"] == 2 - - -def test_app_deprecation(caplog, mocker): - with pytest.deprecated_call(): - procrastinate.PostgresJobStore() - assert caplog.records[0].levelname == "WARNING" - assert caplog.records[0].message.startswith("Deprecation Warning") diff --git a/tests/unit/test_app.py b/tests/unit/test_app.py index 230bcf774..23b7282dd 100644 --- a/tests/unit/test_app.py +++ b/tests/unit/test_app.py @@ -3,7 +3,6 @@ import pendulum import pytest -from procrastinate import aiopg_connector from procrastinate import app as app_module from procrastinate import tasks @@ -12,13 +11,6 @@ def task_func(): pass -def test_app_deprecation(caplog): - with pytest.deprecated_call(): - app_module.App(job_store=aiopg_connector.PostgresConnector) - assert caplog.records[0].levelname == "WARNING" - assert caplog.records[0].message.startswith("Deprecation Warning") - - def test_app_no_connector(): with pytest.raises(TypeError): app_module.App()