Skip to content
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

Lock file maintenance #655

Merged
merged 3 commits into from
Jul 21, 2022
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
109 changes: 54 additions & 55 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ testpaths =
filterwarnings =
# disabling this because it causes flakiness in the tests (see #355)
# error

asyncio_mode = auto
DJANGO_SETTINGS_MODULE = tests.acceptance.django_settings

[mypy]
Expand Down
2 changes: 0 additions & 2 deletions tests/acceptance/test_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import procrastinate

pytestmark = pytest.mark.asyncio


@pytest.fixture
async def async_app_context_manager(not_opened_aiopg_connector):
Expand Down
2 changes: 0 additions & 2 deletions tests/acceptance/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import pytest

pytestmark = pytest.mark.asyncio


@pytest.fixture
async def shell(process_env):
Expand Down
2 changes: 0 additions & 2 deletions tests/acceptance/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import procrastinate

pytestmark = pytest.mark.asyncio


@pytest.fixture
def sync_app_explicit_open(not_opened_psycopg2_connector):
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/test_aiopg_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

from procrastinate import aiopg_connector

pytestmark = pytest.mark.asyncio


@pytest.fixture
async def aiopg_connector_factory(connection_params):
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

from .. import conftest

pytestmark = pytest.mark.asyncio


@pytest.fixture
def pg_job_manager(aiopg_connector):
Expand Down
4 changes: 0 additions & 4 deletions tests/integration/test_wait_stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from procrastinate import worker as worker_module


@pytest.mark.asyncio
async def test_wait_for_activity(aiopg_connector):
"""
Testing that a new event interrupts the wait
Expand All @@ -26,7 +25,6 @@ async def test_wait_for_activity(aiopg_connector):
pytest.fail("Failed to stop worker within .2s")


@pytest.mark.asyncio
async def test_wait_for_activity_timeout(aiopg_connector):
"""
Testing that we timeout if nothing happens
Expand All @@ -46,7 +44,6 @@ async def test_wait_for_activity_timeout(aiopg_connector):
worker.notify_event.set()


@pytest.mark.asyncio
async def test_wait_for_activity_stop_from_signal(aiopg_connector, kill_own_pid):
"""
Testing than ctrl+c interrupts the wait
Expand All @@ -64,7 +61,6 @@ async def test_wait_for_activity_stop_from_signal(aiopg_connector, kill_own_pid)
pytest.fail("Failed to stop worker within .2s")


@pytest.mark.asyncio
async def test_wait_for_activity_stop(aiopg_connector):
"""
Testing than calling job_manager.stop() interrupts the wait
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

from procrastinate import worker

pytestmark = pytest.mark.asyncio


@pytest.fixture
async def running_worker(app):
Expand Down
9 changes: 0 additions & 9 deletions tests/unit/test_aiopg_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def connector():
return aiopg_connector.AiopgConnector()


@pytest.mark.asyncio
async def test_adapt_pool_args_on_connect(mocker):
called = []

Expand All @@ -30,7 +29,6 @@ async def on_connect(connection):
assert called == [connection]


@pytest.mark.asyncio
async def test_wrap_exceptions_wraps():
@aiopg_connector.wrap_exceptions
async def corofunc():
Expand All @@ -42,7 +40,6 @@ async def corofunc():
await coro


@pytest.mark.asyncio
async def test_wrap_exceptions_success():
@aiopg_connector.wrap_exceptions
async def corofunc(a, b):
Expand All @@ -51,7 +48,6 @@ async def corofunc(a, b):
assert await corofunc(1, 2) == (1, 2)


@pytest.mark.asyncio
@pytest.mark.parametrize(
"maxsize, expected_calls_count",
[
Expand Down Expand Up @@ -84,7 +80,6 @@ async def corofunc(connector):
)


@pytest.mark.asyncio
@pytest.mark.parametrize(
"exception_class", [Exception, psycopg2.errors.OperationalError]
)
Expand All @@ -105,7 +100,6 @@ async def corofunc(connector):
assert len(called) == 1


@pytest.mark.asyncio
async def test_wrap_query_exceptions_success(mocker):
called = []

Expand Down Expand Up @@ -141,7 +135,6 @@ def test_wrap_exceptions_applied(method_name, connector):
assert getattr(connector, method_name)._exceptions_wrapped is True


@pytest.mark.asyncio
async def test_listen_notify_pool_one_connection(mocker, caplog, connector):
pool = mocker.Mock(maxsize=1)
await connector.open_async(pool)
Expand Down Expand Up @@ -174,7 +167,6 @@ async def _create_pool(self, pool_args):
return FakeConnector()


@pytest.mark.asyncio
async def test_open_async_no_pool_specified(fake_connector):

await fake_connector.open_async()
Expand All @@ -184,7 +176,6 @@ async def test_open_async_no_pool_specified(fake_connector):
assert fake_connector.create_pool_args == fake_connector._pool_args


@pytest.mark.asyncio
async def test_open_async_pool_argument_specified(fake_connector):
pool = object()
await fake_connector.open_async(pool)
Expand Down
3 changes: 0 additions & 3 deletions tests/unit/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ def test_close(app, connector):
assert connector.states == ["closed"]


@pytest.mark.asyncio
async def test_async_enter_exit(not_opened_app, pool, connector):
async with not_opened_app.open_async(pool) as app:
pass
Expand All @@ -158,15 +157,13 @@ async def test_async_enter_exit(not_opened_app, pool, connector):
assert app is not_opened_app # checks that open_async returns the app instance


@pytest.mark.asyncio
async def test_open_async(not_opened_app, pool, connector):
app = await not_opened_app.open_async(pool)

assert connector.states == ["open_async"]
assert app is not_opened_app # checks that open_async returns the app instance


@pytest.mark.asyncio
async def test_close_async(app, connector):
connector.reset()
await app.close_async()
Expand Down
4 changes: 0 additions & 4 deletions tests/unit/test_builtin_tasks.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import pytest

from procrastinate import builtin_tasks, job_context

pytestmark = pytest.mark.asyncio


async def test_remove_old_jobs(app):

Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ def test_filter_none():
"listen_notify",
],
)
@pytest.mark.asyncio
async def test_missing_app_async(method_name):
with pytest.raises(exceptions.MissingApp):
# Some of this methods are not async but they'll raise
Expand Down
3 changes: 0 additions & 3 deletions tests/unit/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ def test_open(connector):
connector.open()


@pytest.mark.asyncio
async def test_open_async(connector):
await connector.open_async()

Expand All @@ -17,7 +16,6 @@ def test_close(connector):
connector.close()


@pytest.mark.asyncio
async def test_close_async(connector):
await connector.close_async()

Expand All @@ -33,7 +31,6 @@ async def test_close_async(connector):
["listen_notify", {"event": None, "channels": []}],
],
)
@pytest.mark.asyncio
async def test_missing_app_async(method_name, kwargs):
with pytest.raises(exceptions.SyncConnectorConfigurationError):
# Some of this methods are not async but they'll raise
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def test_job_evolve(job_factory):
assert job.evolve(id=13, lock="bu") == expected


@pytest.mark.asyncio
async def test_job_deferrer_defer_async(job_factory, job_manager, connector):

job = job_factory(
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

from .. import conftest

pytestmark = pytest.mark.asyncio


async def test_manager_defer_job(job_manager, job_factory, connector):
job = await job_manager.defer_job_async(
Expand Down
7 changes: 0 additions & 7 deletions tests/unit/test_periodic.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,13 @@ def test_get_timestamp_no_since_not_within_delay(periodic_deferrer, cron_task, c
assert [r.action for r in caplog.records] == ["ignore_periodic_task"]


@pytest.mark.asyncio
async def test_worker_no_task(periodic_deferrer, caplog):
caplog.set_level("INFO")
await periodic_deferrer.worker()

assert [r.action for r in caplog.records] == ["periodic_deferrer_no_task"]


@pytest.mark.asyncio
async def test_worker_loop(mocker, task):
# The idea of this test is to make the inifite loop raise at some point
mock = mocker.Mock()
Expand Down Expand Up @@ -200,7 +198,6 @@ def get_next_tick(self, at):
]


@pytest.mark.asyncio
async def test_wait_next_tick(periodic_deferrer, mocker):
async def wait(val):
assert val == 5 + periodic.MARGIN
Expand All @@ -210,7 +207,6 @@ async def wait(val):
await periodic_deferrer.wait(5)


@pytest.mark.asyncio
async def test_defer_jobs(periodic_deferrer, task, connector, caplog):
caplog.set_level("DEBUG")

Expand Down Expand Up @@ -242,7 +238,6 @@ async def test_defer_jobs(periodic_deferrer, task, connector, caplog):
assert [r.action for r in caplog.records] == ["periodic_task_deferred"]


@pytest.mark.asyncio
async def test_defer_jobs_different_periodic_id(
periodic_deferrer, task, connector, caplog
):
Expand Down Expand Up @@ -272,7 +267,6 @@ async def test_defer_jobs_different_periodic_id(
assert [r.action for r in caplog.records] == ["periodic_task_deferred"]


@pytest.mark.asyncio
async def test_defer_jobs_already(periodic_deferrer, task, connector, caplog):
caplog.set_level("DEBUG")
connector.periodic_defers[(task.name, "foo")] = 1
Expand Down Expand Up @@ -300,7 +294,6 @@ async def test_defer_jobs_already(periodic_deferrer, task, connector, caplog):
assert [r.action for r in caplog.records] == ["periodic_task_already_deferred"]


@pytest.mark.asyncio
async def test_defer_jobs_queueing_lock(periodic_deferrer, task, caplog):
caplog.set_level("DEBUG")

Expand Down
3 changes: 0 additions & 3 deletions tests/unit/test_schema.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from collections import defaultdict

import pytest


def test_get_schema(app):
assert app.schema_manager.get_schema().startswith("-- Procrastinate Schema")
Expand All @@ -19,7 +17,6 @@ def test_apply_schema(app, connector):
assert connector.queries == [("apply_schema", {})]


@pytest.mark.asyncio
async def test_apply_schema_async(app, connector):
connector.reverse_queries = defaultdict(lambda: "apply_schema")
connector.set_schema_version_run = lambda *a, **kw: None
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/test_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from procrastinate import signals


@pytest.mark.asyncio
@pytest.mark.parametrize("one_signal", [signal.SIGINT, signal.SIGTERM])
async def test_on_stop_async(one_signal, kill_own_pid):
called = []
Expand Down Expand Up @@ -69,7 +68,6 @@ def test_on_stop_signal_unused(kill_own_pid):
assert before is not during


@pytest.mark.asyncio
async def test_on_stop_work_with_asyncio(kill_own_pid):
# In this test, we want to make sure that interacting with synchronisation
# primitives from within a signal handler works.
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def test_task_init_with_no_name(app):
assert task.name == "tests.unit.test_tasks.task_func"


@pytest.mark.asyncio
async def test_task_defer_async(app, connector):
task = tasks.Task(task_func, blueprint=app, queue="queue")

Expand Down
4 changes: 0 additions & 4 deletions tests/unit/test_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ def b(**kwargs):
assert result == {"i": "j"}


@pytest.mark.asyncio
async def test_execute_query(connector, mocker):
connector.generic_execute = mocker.Mock()
await connector.execute_query_async("a", b="c")
connector.generic_execute.assert_called_with("a", "run", b="c")


@pytest.mark.asyncio
async def test_execute_query_one(connector, mocker):
connector.generic_execute = mocker.Mock()
assert (
Expand All @@ -44,7 +42,6 @@ async def test_execute_query_one(connector, mocker):
connector.generic_execute.assert_called_with("a", "one", b="c")


@pytest.mark.asyncio
async def test_execute_query_all_async(connector, mocker):
connector.generic_execute = mocker.Mock()
assert (
Expand Down Expand Up @@ -361,7 +358,6 @@ def test_listen_for_jobs_run(connector):
connector.listen_for_jobs_run()


@pytest.mark.asyncio
async def test_defer_no_notify(connector):
# This test is there to check that if the deferred queue doesn't match the
# listened queue, the testing connector doesn't notify.
Expand Down
Loading