Skip to content
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
1 change: 1 addition & 0 deletions newsfragments/1402.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Gathered all executors under common executors package.
6 changes: 6 additions & 0 deletions pytest_postgresql/executors/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Collection of executors."""

from .noop import NoopExecutor
from .proc import PostgreSQLExecutor

__all__ = ["NoopExecutor", "PostgreSQLExecutor"]
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions pytest_postgresql/factories/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@

from pytest_postgresql._asyncio_compat import mark_postgresql_async_fixture, supports_loop_factories
from pytest_postgresql.config import get_config
from pytest_postgresql.executor import PostgreSQLExecutor
from pytest_postgresql.executor_noop import NoopExecutor
from pytest_postgresql.executors import NoopExecutor, PostgreSQLExecutor
from pytest_postgresql.janitor import AsyncDatabaseJanitor, DatabaseJanitor

try:
Expand Down
2 changes: 1 addition & 1 deletion pytest_postgresql/factories/noprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from pytest import FixtureRequest

from pytest_postgresql.config import get_config
from pytest_postgresql.executor_noop import NoopExecutor
from pytest_postgresql.executors import NoopExecutor
from pytest_postgresql.janitor import DatabaseJanitor


Expand Down
2 changes: 1 addition & 1 deletion pytest_postgresql/factories/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from pytest import FixtureRequest, TempPathFactory

from pytest_postgresql.config import PostgreSQLConfig, get_config
from pytest_postgresql.executor import PostgreSQLExecutor
from pytest_postgresql.executors import PostgreSQLExecutor
from pytest_postgresql.factories._pg import _pg_exe
from pytest_postgresql.janitor import DatabaseJanitor

Expand Down
3 changes: 1 addition & 2 deletions tests/test_chaining.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import psycopg

from pytest_postgresql import factories
from pytest_postgresql.executor import PostgreSQLExecutor
from pytest_postgresql.executor_noop import NoopExecutor
from pytest_postgresql.executors import NoopExecutor, PostgreSQLExecutor


def load_schema(*, host: str, port: int, user: str, dbname: str, password: str | None, autocommit: bool) -> None:
Expand Down
10 changes: 5 additions & 5 deletions tests/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import pytest_postgresql.factories.process as process
from pytest_postgresql.config import get_config
from pytest_postgresql.exceptions import PostgreSQLUnsupported
from pytest_postgresql.executor import PostgreSQLExecutor
from pytest_postgresql.executors import PostgreSQLExecutor
from pytest_postgresql.factories import _pg, postgresql, postgresql_async, postgresql_proc
from pytest_postgresql.retry import retry

Expand Down Expand Up @@ -114,7 +114,7 @@ def test_clean_directory_retains_directory_initialised_on_rmtree_failure(tmp_pat

with (
patch.object(executor, "running", return_value=False),
patch("pytest_postgresql.executor.shutil.rmtree", side_effect=OSError("permission denied")),
patch("pytest_postgresql.executors.proc.shutil.rmtree", side_effect=OSError("permission denied")),
):
executor.clean_directory()

Expand All @@ -130,7 +130,7 @@ def test_clean_directory_clears_directory_initialised_on_success(tmp_path: Path)

with (
patch.object(executor, "running", return_value=False),
patch("pytest_postgresql.executor.shutil.rmtree") as rmtree_mock,
patch("pytest_postgresql.executors.proc.shutil.rmtree") as rmtree_mock,
):
executor.clean_directory()

Expand All @@ -149,7 +149,7 @@ def test_init_directory_logs_password_file_cleanup_failure(
with (
patch.object(executor, "clean_directory"),
patch.object(executor, "_run_initdb"),
patch("pytest_postgresql.executor.os.unlink", side_effect=OSError("busy")),
patch("pytest_postgresql.executors.proc.os.unlink", side_effect=OSError("busy")),
caplog.at_level(logging.WARNING, logger="pytest_postgresql.executor"),
):
executor.init_directory()
Expand Down Expand Up @@ -327,7 +327,7 @@ def test_executor_platform_template_selection(
tmpdir = tmp_path_factory.mktemp(f"pytest-postgresql-{request.node.name}")
datadir, logfile_path = process._prepare_dir(tmpdir, port, "test")

with patch("pytest_postgresql.executor.platform.system", return_value=platform_name):
with patch("pytest_postgresql.executors.proc.platform.system", return_value=platform_name):
executor = PostgreSQLExecutor(
executable=pg_exe,
host=config.host,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_janitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from packaging.version import parse
from psycopg import AsyncCursor

from pytest_postgresql.executor import PostgreSQLExecutor
from pytest_postgresql.executors import PostgreSQLExecutor
from pytest_postgresql.factories.noprocess import xdistify_dbname
from pytest_postgresql.janitor import AsyncDatabaseJanitor, DatabaseJanitor

Expand Down
3 changes: 1 addition & 2 deletions tests/test_noopexecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import psycopg
import pytest

from pytest_postgresql.executor import PostgreSQLExecutor
from pytest_postgresql.executor_noop import NoopExecutor
from pytest_postgresql.executors import NoopExecutor, PostgreSQLExecutor
from pytest_postgresql.janitor import DatabaseJanitor
from pytest_postgresql.retry import retry

Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugin_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import pytest_postgresql
import pytest_postgresql.plugin as plugin_module
from pytest_postgresql._asyncio_compat import item_uses_postgresql_async_fixture
from pytest_postgresql.executor import PostgreSQLExecutor
from pytest_postgresql.executors import PostgreSQLExecutor
from pytest_postgresql.factories import postgresql_proc
from pytest_postgresql.factories.client import postgresql_async
from pytest_postgresql.plugin import (
Expand Down
2 changes: 1 addition & 1 deletion tests/test_postgres_options_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pytest import Pytester

import pytest_postgresql
from pytest_postgresql.executor import PostgreSQLExecutor
from pytest_postgresql.executors import PostgreSQLExecutor
from pytest_postgresql.factories import postgresql_proc
from pytest_postgresql.factories.noprocess import xdistify_dbname
from pytest_postgresql.janitor import DatabaseJanitor
Expand Down
2 changes: 1 addition & 1 deletion tests/test_postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from psycopg import AsyncConnection, Connection
from psycopg.pq import ConnStatus

from pytest_postgresql.executor import PostgreSQLExecutor
from pytest_postgresql.executors import PostgreSQLExecutor
from pytest_postgresql.retry import retry, retry_async
from tests.conftest import POSTGRESQL_VERSION

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

import pytest

from pytest_postgresql.executor import PostgreSQLExecutor
from pytest_postgresql.executors import PostgreSQLExecutor


@pytest.mark.parametrize(
Expand Down
Loading
Loading