Upgrading pytest-postgresql 8 to 9
Breaking8.1.0 → 9.1.1Breaking5Deprecated1New4Changed2Fixed3Other20
BreakingUpgrade verdict
4 breaking changes.
In plain terms
- Calls that pass options, load, load_autocommit or depends_on by position to postgresql_noproc must switch to keywords.
- Calls that pass options, startparams, unixsocketdir, postgres_options, load or load_autocommit by position to postgresql_proc must switch to keywords.
- Calls that pass shell, timeout, sleep, user, password, options or postgres_options by position to PostgreSQLExecutor must switch to keywords.
- If you supply your own function to load SQL into the test database, it now receives an extra autocommit setting.
Must act Top 4 of 5 that need code or config changes
What you must change
Breaking4
Arguments after dbname in postgresql_noproc are now keyword-only.
postgresql_noprocdbnameoptionsloadload_autocommitdepends_onArguments after dbname in postgresql_proc are now keyword-only.
postgresql_procdbnameoptionsstartparamsunixsocketdirpostgres_optionsloadload_autocommitArguments after dbname in PostgreSQLExecutor are now keyword-only.
PostgreSQLExecutordbnameshelltimeoutsleepuserpasswordoptionsLoad functions passed to proc/noproc fixtures must now accept a new autocommit argument.
postgresql_procpostgresql_noprocautocommitDeprecations to plan for
Deprecated1
Deprecates the unused version argument of DatabaseJanitor and AsyncDatabaseJanitor.
DatabaseJanitorAsyncDatabaseJanitorversionAPI changes
Generated by DepDelta from published Python source. Not mixed with prose notes.
- changed:
field PostgreSQLConfig.password: str → field PostgreSQLConfig.password: str | None - changed:
function get_config(request: FixtureRequest) -> PostgreSQLConfig → function get_config(request: pytest.FixtureRequest) -> PostgreSQLConfig - added:
field PostgreSQLConfig.load_autocommit: bool - added:
field PostgreSQLConfig.maintenance_dbname: str
- added:
static method ExecutableMissingException.discovery_failed(causes: Iterable[str], checked: Iterable[str]) -> ExecutableMissingException - added:
static method ExecutableMissingException.not_in_bindir(bindir: str, checked: Iterable[str]) -> ExecutableMissingException - added:
static method ExecutableMissingException.pg_config_unusable(reason: str, checked: Iterable[str]) -> ExecutableMissingException
- removed:
class PostgreSQLExecutor(TCPExecutor) - removed:
constructor PostgreSQLExecutor(executable: str, host: str, port: int, datadir: str, unixsocketdir: str, logfile: str, startparams: str, dbname: str, shell: bool=…, timeout: Optional[int]=…, sleep: float=…, user: str=…, password: str=…, options: str=…, postgres_options: str=…) - removed:
field PostgreSQLExecutor.MIN_SUPPORTED_VERSION - removed:
field PostgreSQLExecutor.UNIX_PROC_START_COMMAND - removed:
field PostgreSQLExecutor.VERSION_RE - removed:
field PostgreSQLExecutor.WINDOWS_PROC_START_COMMAND - removed:
method PostgreSQLExecutor.check_subprocess() -> bool - removed:
method PostgreSQLExecutor.clean_directory() -> None - removed:
method PostgreSQLExecutor.init_directory() -> None - removed:
method PostgreSQLExecutor.running() -> bool - removed:
method PostgreSQLExecutor.start() -> T - removed:
method PostgreSQLExecutor.stop(sig: Optional[int]=…, exp_sig: Optional[int]=…) -> T - removed:
method PostgreSQLExecutor.wait_for_postgres() -> None - removed:
property PostgreSQLExecutor.template_dbname -> str - removed:
property PostgreSQLExecutor.version -> Any - removed:
variable T - removed:
variable logger
- removed:
class NoopExecutor - removed:
constructor NoopExecutor(host: str, port: str | int, user: str, options: str, dbname: str, password: str | None=…) - removed:
property NoopExecutor.template_dbname -> str - removed:
property NoopExecutor.version -> Any
- added:
export NoopExecutor - added:
export PostgreSQLExecutor
- added:
class NoopExecutor - added:
constructor NoopExecutor(host: str, port: str | int, user: str, options: str, dbname: str, password: str | None=…, maintenance_dbname: str=…) - added:
property NoopExecutor.template_dbname -> str - added:
property NoopExecutor.version -> Any
- added:
class PostgreSQLExecutor(TCPExecutor) - added:
constructor PostgreSQLExecutor(executable: str, host: str, port: int, datadir: str, unixsocketdir: str, logfile: str, startparams: str, dbname: str, *, shell: bool=…, timeout: Optional[int]=…, sleep: float=…, user: str=…, password: str | None=…, options: str=…, postgres_options: str=…) - added:
field PostgreSQLExecutor.MIN_SUPPORTED_VERSION - added:
field PostgreSQLExecutor.UNIX_PROC_START_COMMAND - added:
field PostgreSQLExecutor.VERSION_RE - added:
field PostgreSQLExecutor.WINDOWS_PROC_START_COMMAND - added:
method PostgreSQLExecutor.check_subprocess() -> bool - added:
method PostgreSQLExecutor.clean_directory() -> None - added:
method PostgreSQLExecutor.init_directory() -> None - added:
method PostgreSQLExecutor.running() -> bool - added:
method PostgreSQLExecutor.start() -> T - added:
method PostgreSQLExecutor.stop(sig: Optional[int]=…, exp_sig: Optional[int]=…) -> T - added:
method PostgreSQLExecutor.wait_for_postgres() -> None - added:
property PostgreSQLExecutor.maintenance_dbname -> str - added:
property PostgreSQLExecutor.template_dbname -> str - added:
property PostgreSQLExecutor.version -> Any - added:
variable T - added:
variable logger
- added:
export postgresql_async
- changed:
function postgresql(process_fixture_name: str, dbname: str | None=…, isolation_level: psycopg.IsolationLevel | None=…) -> Callable[[FixtureRequest], Iterator[Connection]] → function postgresql(process_fixture_name: str, dbname: str | None=…, isolation_level: psycopg.IsolationLevel | None=…) -> Callable[[pytest.FixtureRequest], Iterator[Connection]] - added:
function postgresql_async(process_fixture_name: str, dbname: str | None=…, isolation_level: psycopg.IsolationLevel | None=…) -> Callable[[pytest.FixtureRequest], AsyncIterator[AsyncConnection]] - added:
variable pytest_asyncio
- changed:
function postgresql_noproc(host: str | None=…, port: str | int | None=…, user: str | None=…, password: str | None=…, dbname: str | None=…, options: str=…, load: list[Callable | str | Path] | None=…, depends_on: str | None=…) -> Callable[[FixtureRequest], Iterator[NoopExecutor]] → function postgresql_noproc(host: str | None=…, port: str | int | None=…, user: str | None=…, password: str | None=…, dbname: str | None=…, *, maintenance_dbname: str | None=…, options: str=…, load: list[Callable | str | Path] | None=…, load_autocommit: bool | None=…, depends_on: str | None=…) -> Callable[[pytest.FixtureRequest], Iterator[NoopExecutor]]
- changed:
function postgresql_proc(executable: str | None=…, host: str | None=…, port: PortType | None=…, user: str | None=…, password: str | None=…, dbname: str | None=…, options: str=…, startparams: str | None=…, unixsocketdir: str | None=…, postgres_options: str | None=…, load: list[Callable | str | Path] | None=…) -> Callable[[FixtureRequest, TempPathFactory], Iterator[PostgreSQLExecutor]] → function postgresql_proc(executable: str | None=…, host: str | None=…, port: PortType | None=…, user: str | None=…, password: str | None=…, dbname: str | None=…, *, options: str=…, startparams: str | None=…, unixsocketdir: str | None=…, postgres_options: str | None=…, load: list[Callable | str | Path] | None=…, load_autocommit: bool | None=…) -> Callable[[pytest.FixtureRequest, pytest.TempPathFac… - added:
variable logger
- removed:
constructor DatabaseJanitor(*, user: str, host: str, port: str | int, version: str | float | Version, dbname: str, template_dbname: str | None=…, as_template: bool=…, password: str | None=…, isolation_level: psycopg.IsolationLevel | None=…, connection_timeout: int=…) -> None - removed:
method DatabaseJanitor.is_template() -> bool - removed:
variable Version - changed:
class DatabaseJanitor → class DatabaseJanitor(BaseDatabaseJanitor) - changed:
method DatabaseJanitor.cursor(dbname: str=…) -> Iterator[Cursor] → method DatabaseJanitor.cursor(dbname: str | None=…) -> Iterator[Cursor] - added:
async method AsyncDatabaseJanitor.cursor(dbname: str | None=…) -> AsyncIterator[AsyncCursor] - added:
async method AsyncDatabaseJanitor.drop() -> None - added:
async method AsyncDatabaseJanitor.init() -> None - added:
async method AsyncDatabaseJanitor.load(load: Callable | str | Path) -> None - added:
class AsyncDatabaseJanitor(BaseDatabaseJanitor) - added:
class BaseDatabaseJanitor - added:
constructor BaseDatabaseJanitor(*, user: str, host: str, port: str | int, version: str | float | Version | None=…, dbname: str, template_dbname: str | None=…, maintenance_dbname: str=…, as_template: bool=…, password: str | None=…, isolation_level: psycopg.IsolationLevel | None=…, autocommit: bool=…, connection_timeout: int=…) -> None - added:
field BaseDatabaseJanitor.as_template: bool - added:
field BaseDatabaseJanitor.autocommit: bool - added:
field BaseDatabaseJanitor.dbname: str - added:
field BaseDatabaseJanitor.host: str - added:
field BaseDatabaseJanitor.isolation_level: psycopg.IsolationLevel | None - added:
field BaseDatabaseJanitor.maintenance_dbname: str - added:
field BaseDatabaseJanitor.password: str | None - added:
field BaseDatabaseJanitor.port: str | int - added:
field BaseDatabaseJanitor.template_dbname: str | None - added:
field BaseDatabaseJanitor.user: str - added:
field BaseDatabaseJanitor.version: Version | None - added:
method BaseDatabaseJanitor.is_template() -> bool - added:
variable AsyncDatabaseJanitorType
- changed:
function build_loader(load: Callable | str | Path) -> Callable → function build_loader(load: Callable | str | Path, *, sql_loader: Callable[..., Any]=…) -> Callable - added:
async function sql_async(sql_filename: Path, **kwargs: Any) -> None - added:
variable aiofiles - added:
variable aiofiles: ModuleType | None
- added:
function pytest_asyncio_loop_factories(config: pytest.Config, item: pytest.Item) -> Generator[None, object, None] - added:
function pytest_configure(config: pytest.Config) -> None - added:
variable postgresql_async - added:
variable pytest_asyncio
- added:
async function retry_async(func: Callable[[], Awaitable[T]], timeout: int=…, possible_exception: Type[Exception]=…) -> T