postgresql_exec defaults to /usr/lib/postgresql/14/bin/pg_ctl (pytest_postgresql/plugin.py:147), a Linux path that can never exist on Windows. Windows users always fall through to pg_config --bindir, and the Windows installer does not put pg_config on PATH — so discovery fails and the fixture cannot start a server without an explicit --postgresql-exec.
What we want
- Make the
postgresql_exec default platform-aware, or drop the hardcoded default in favour of discovery.
- Extend
_pg_exe (pytest_postgresql/factories/process.py) to probe %ProgramFiles%\PostgreSQL\*\bin\pg_ctl.exe, newest version first, then shutil.which("pg_ctl").
- Drop
--postgresql-exec from single-postgres-windows.yml and delete .github/actions/detect-pg-ctl, so CI exercises real discovery instead of bypassing it.
Where to look
.github/actions/detect-pg-ctl/action.yml — the discovery logic already exists here in PowerShell (Program Files path, then Get-Command pg_ctl). Port it into _pg_exe.
tests/test_pg_exe.py::test_windows_executable_suffix_is_probed — how to unit-test Windows path handling from Linux CI, by patching PG_CTL_NAMES.
os.access(path, os.X_OK) ignores X_OK on Windows, so the executable check in _pg_exe is an existence test there. Skip any permission-based test on Windows.
postgresql_execdefaults to/usr/lib/postgresql/14/bin/pg_ctl(pytest_postgresql/plugin.py:147), a Linux path that can never exist on Windows. Windows users always fall through topg_config --bindir, and the Windows installer does not putpg_configonPATH— so discovery fails and the fixture cannot start a server without an explicit--postgresql-exec.What we want
postgresql_execdefault platform-aware, or drop the hardcoded default in favour of discovery._pg_exe(pytest_postgresql/factories/process.py) to probe%ProgramFiles%\PostgreSQL\*\bin\pg_ctl.exe, newest version first, thenshutil.which("pg_ctl").--postgresql-execfromsingle-postgres-windows.ymland delete.github/actions/detect-pg-ctl, so CI exercises real discovery instead of bypassing it.Where to look
.github/actions/detect-pg-ctl/action.yml— the discovery logic already exists here in PowerShell (Program Files path, thenGet-Command pg_ctl). Port it into_pg_exe.tests/test_pg_exe.py::test_windows_executable_suffix_is_probed— how to unit-test Windows path handling from Linux CI, by patchingPG_CTL_NAMES.os.access(path, os.X_OK)ignoresX_OKon Windows, so the executable check in_pg_exeis an existence test there. Skip any permission-based test on Windows.