Skip to content

Commit

Permalink
Merge pull request #1013 from procrastinate-org/warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ewjoachim authored Mar 23, 2024
2 parents d637eef + 1a387ab commit e6c7e8e
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 26 deletions.
18 changes: 17 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions procrastinate/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ def extract_metadata() -> Mapping[str, str]:
metadata = importlib_metadata.metadata("procrastinate")

return {
"author": metadata["Author"],
"email": metadata["Author-email"],
"license": metadata["License"],
"url": metadata["Home-page"],
"version": metadata["Version"],
"author": metadata.get("Author", ""),
"email": metadata.get("Author-email", ""),
"license": metadata.get("License", ""),
"url": metadata.get("Home-page", ""),
"version": metadata.get("Version", ""),
}
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ pytest-cov = "*"
pytest-django = "*"
pytest-mock = "*"
migra = "*"
# migra depends on schemainspect, which has an implicit dependency on setuptools
# (pkg_resources).
setuptools = { version = "*", python = ">=3.12" }

[tool.poetry.group.docs.dependencies]
django = ">=2.2"
Expand Down Expand Up @@ -103,7 +106,10 @@ testpaths = [
"tests/acceptance",
"tests/migration",
]
filterwarnings = ""
filterwarnings = """
error
ignore:unclosed.+:ResourceWarning
"""
asyncio_mode = "auto"
DJANGO_SETTINGS_MODULE = "tests.acceptance.django_settings"

Expand Down
27 changes: 9 additions & 18 deletions tests/integration/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ async def test_finish_job_wrong_end_status(
async def test_retry_job(pg_job_manager, fetched_job_factory):
job1 = await fetched_job_factory(queue="queue_a")

await pg_job_manager.retry_job(job=job1, retry_at=datetime.datetime.utcnow())
await pg_job_manager.retry_job(
job=job1, retry_at=datetime.datetime.now(datetime.timezone.utc)
)

job2 = await pg_job_manager.fetch_job(queues=None)

Expand Down Expand Up @@ -480,23 +482,12 @@ async def test_list_tasks_dict(fixture_jobs, pg_job_manager):
}


async def test_list_locks_dict(fixture_jobs, job_factory, pg_job_manager):
pg_job_manager.defer_job_async(
job=job_factory(
queue="q3",
lock=None,
queueing_lock="queueing_lock3",
task_name="task_foo",
task_kwargs={"key": "a"},
)
)
assert (await pg_job_manager.list_locks_async())[0] == {
"name": "lock1",
"jobs_count": 1,
"todo": 1,
"doing": 0,
"succeeded": 0,
"failed": 0,
async def test_list_locks_dict(fixture_jobs, pg_job_manager):
assert {e["name"] for e in await pg_job_manager.list_locks_async()} == {
"lock1",
"lock2",
"lock3",
"lock4",
}


Expand Down
12 changes: 11 additions & 1 deletion tests/migration/test_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@

import contextlib
import pathlib
import warnings

import pytest
from django.core import management
from django.db import connection
from migra import Migration
from sqlalchemy.pool import NullPool
from sqlbag import S

from procrastinate import psycopg_connector, schema

with warnings.catch_warnings(record=True):
# migra uses schemainspect which uses pkg_resources which is deprecated
warnings.filterwarnings(
action="ignore", category=DeprecationWarning, module="pkg_resources"
)
warnings.filterwarnings(
action="ignore", category=DeprecationWarning, module="schemainspect"
)
from migra import Migration


@pytest.fixture
def run_migrations(db_execute):
Expand Down

0 comments on commit e6c7e8e

Please sign in to comment.