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

Bump black from 23.11.0 to 23.12.0 #858

Merged
merged 2 commits into from
Dec 15, 2023
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
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ towncrier = "==23.11.0"
pytest-cov = "==4.1.0"
pytest-xdist = "==3.5.0"
mock = "==5.1.0"
black = "==23.11.0"
black = "==23.12.0"
mypy = "==1.7.1"
types-setuptools = "==69.0.0.0"
tbump = "==6.11.0"
Expand Down
1 change: 1 addition & 0 deletions newsfragments/858.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replace usage of `pkg_resources.parse_version` with `packaging.version.parse`
6 changes: 3 additions & 3 deletions pytest_postgresql/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

from mirakuru import TCPExecutor
from mirakuru.exceptions import ProcessFinishedWithError
from pkg_resources import parse_version
from packaging.version import parse

from pytest_postgresql.exceptions import ExecutableMissingException, PostgreSQLUnsupported

Expand Down Expand Up @@ -57,7 +57,7 @@ class PostgreSQLExecutor(TCPExecutor):
)

VERSION_RE = re.compile(r".* (?P<version>\d+(?:\.\d+)?)")
MIN_SUPPORTED_VERSION = parse_version("10")
MIN_SUPPORTED_VERSION = parse("10")

def __init__(
self,
Expand Down Expand Up @@ -203,7 +203,7 @@ def version(self) -> Any:
) from ex
matches = self.VERSION_RE.search(version_string)
assert matches is not None
return parse_version(matches.groupdict()["version"])
return parse(matches.groupdict()["version"])

def running(self) -> bool:
"""Check if server is running."""
Expand Down
4 changes: 2 additions & 2 deletions pytest_postgresql/executor_noop.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from typing import Any, Optional, Union

import psycopg
from pkg_resources import parse_version
from packaging.version import parse


class NoopExecutor:
Expand Down Expand Up @@ -84,5 +84,5 @@ def version(self) -> Any:
if not int(part):
continue
version_parts.append(part)
self._version = parse_version(".".join(version_parts[:2]))
self._version = parse(".".join(version_parts[:2]))
return self._version
6 changes: 3 additions & 3 deletions pytest_postgresql/janitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
from typing import Callable, Iterator, Optional, Type, TypeVar, Union

import psycopg
from pkg_resources import parse_version
from packaging.version import parse
from psycopg import Connection, Cursor

from pytest_postgresql.retry import retry
from pytest_postgresql.sql import loader

Version = type(parse_version("1"))
Version = type(parse("1"))


DatabaseJanitorType = TypeVar("DatabaseJanitorType", bound="DatabaseJanitor")
Expand Down Expand Up @@ -53,7 +53,7 @@ def __init__(
self._connection_timeout = connection_timeout
self.isolation_level = isolation_level
if not isinstance(version, Version):
self.version = parse_version(str(version))
self.version = parse(str(version))
else:
self.version = version

Expand Down
4 changes: 2 additions & 2 deletions tests/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import psycopg
import pytest
from pkg_resources import parse_version
from packaging.version import parse
from port_for import get_port
from psycopg import Connection
from pytest import FixtureRequest
Expand All @@ -22,7 +22,7 @@ class PatchedPostgreSQLExecutor(PostgreSQLExecutor):
@property
def version(self) -> Any:
"""Overwrite version, to always return highest unsupported version."""
return parse_version("8.9")
return parse("8.9")


def test_unsupported_version(request: FixtureRequest) -> None:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_janitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from unittest.mock import MagicMock, patch

import pytest
from pkg_resources import parse_version
from packaging.version import parse

from pytest_postgresql.janitor import DatabaseJanitor

VERSION = parse_version("10")
VERSION = parse("10")


@pytest.mark.parametrize("version", (VERSION, 10, "10"))
Expand Down
Loading