Skip to content

Commit

Permalink
Merge pull request #441 from ClearcodeHQ/portfor
Browse files Browse the repository at this point in the history
Use get_port from port_for
  • Loading branch information
fizyk committed Jun 1, 2021
2 parents 5e4f422 + 9abff54 commit ac5df1a
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 101 deletions.
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

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

0 comments on commit ac5df1a

Please sign in to comment.