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

Use get_port from port_for #441

Merged
merged 1 commit into from
Jun 1, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
CHANGELOG
=========

unreleased
----------

Misc
++++

- rely on `get_port` functionality delivered by `port_for`

3.1.0
----------

Expand Down
3 changes: 0 additions & 3 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,5 @@ ignore_missing_imports = True
[mypy-psycopg2cffi.*]
ignore_missing_imports = True

[mypy-port_for.*]
ignore_missing_imports = True

[mypy-setuptools.*]
ignore_missing_imports = True
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ coverage==5.5 # pytest-cov
pytest==6.2.4
pytest-cov==2.12.0
pytest-xdist==2.2.1
port-for==0.6.0
port-for==0.6.1
mirakuru==2.4.1
-e .[tests]
2 changes: 1 addition & 1 deletion src/pytest_postgresql/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def stop(self: T, sig: Optional[int] = None, exp_sig: Optional[int] = None) -> T
shell=True,
)
try:
super().stop(sig, exp_sig) # type: ignore[arg-type]
super().stop(sig, exp_sig)
except ProcessFinishedWithError:
# Finished, leftovers ought to be cleaned afterwards anyway
pass
Expand Down
18 changes: 15 additions & 3 deletions src/pytest_postgresql/factories/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,34 @@
import platform
import subprocess
from _warnings import warn
from typing import Union, Iterable, Callable, List, Iterator, Optional
from typing import Union, Iterable, Callable, List, Iterator, Optional, Tuple, Set

import pytest
from _pytest.fixtures import FixtureRequest
from _pytest.tmpdir import TempdirFactory
from port_for import get_port
fizyk marked this conversation as resolved.
Show resolved Hide resolved

from pytest_postgresql.config import get_config
from pytest_postgresql.executor import PostgreSQLExecutor
from pytest_postgresql.janitor import DatabaseJanitor
from pytest_postgresql.port import get_port


def postgresql_proc(
executable: Optional[str] = None,
host: Optional[str] = None,
port: Union[str, int, Iterable, None] = -1,
port: Union[
None,
str,
int,
Tuple[int, int],
Set[int],
List[str],
List[int],
List[Tuple[int, int]],
List[Set[int]],
List[Union[Set[int], Tuple[int, int]]],
List[Union[str, int, Tuple[int, int], Set[int]]],
] = -1,
user: Optional[str] = None,
password: Optional[str] = None,
dbname: Optional[str] = None,
Expand Down
92 changes: 0 additions & 92 deletions src/pytest_postgresql/port.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

import psycopg2
import pytest
from port_for import get_port

from pytest_postgresql.executor import PostgreSQLExecutor, PostgreSQLUnsupported
from pytest_postgresql.factories import postgresql_proc, postgresql
from pytest_postgresql.compat import connection
from pytest_postgresql.config import get_config
from pytest_postgresql.port import get_port
from pytest_postgresql.retry import retry


Expand Down