We have some python unit tests that use testing.posgresql, however I cannot get them to work for me on my machine (Windows 10). I get the above error about initdb needing postgresql but not being able to find it in the same directory. I can confirm they are both in the bin directory of the PostgresSQL installation, and I get the same error when trying to run initdb directly while in that directory. The bin and lib directories for this installation are also both in my path, and I get the correct location when running which initdb or which postgres I've tried a handful of things including all solutions proposed in threads with similar issues but nothing worked, it works on macOS and our github workflow. I have PostgresSQL 14 installed and I am using cygwin (although the exact same error appears when run in windows cmd), any help is appreciated.
Output when running initdb from the bin directory of the Postgres installation:
$ ./initdb -D example
The system cannot find the path specified.
child process exited with exit code 1
initdb: error: The program "postgres" is needed by initdb but was not found in the
same directory as "C:/Program Files/PostgreSQL/14/bin/initdb.exe".
Check your installation.
But a simple ls shows postgres.exe is indeed there:
$ ls
clusterdb.exe icutu67.dll libiconv-2.dll libxslt.dll pg_dump.exe pg_restore.exe psql.exe wxmsw313u_core_vc_x64_custom.dll
createdb.exe icuuc67.dll libintl-9.dll oid2name.exe pg_dumpall.exe pg_rewind.exe reindexdb.exe wxmsw313ud_aui_vc_x64_custom.dll
createuser.exe initdb.exe liblz4.dll pg_amcheck.exe pg_isolation_regress.exe pg_test_fsync.exe stackbuilder.exe wxmsw313ud_html_vc_x64_custom.dll
dropdb.exe isolationtester.exe libpgtypes.dll pg_archivecleanup.exe pg_isready.exe pg_test_timing.exe vacuumdb.exe wxmsw313ud_xrc_vc_x64_custom.dll
dropuser.exe libcrypto-1_1-x64.dll libpq.dll pg_basebackup.exe pg_receivewal.exe pg_upgrade.exe vacuumlo.exe zic.exe
ecpg.exe libcurl.dll libpq_pipeline.exe pg_checksums.exe pg_recvlogical.exe pg_verifybackup.exe wxbase313u_vc_x64_custom.dll zlib1.dll
icudt67.dll libcurl.lib libssl-1_1-x64.dll pg_config.exe pg_regress.exe pg_waldump.exe wxbase313u_xml_vc_x64_custom.dll
icuin67.dll libecpg.dll libwinpthread-1.dll pg_controldata.exe pg_regress_ecpg.exe pgbench.exe wxbase313ud_net_vc_x64_custom.dll
icuio67.dll libecpg_compat.dll libxml2.dll pg_ctl.exe pg_resetwal.exe postgres.exe wxmsw313u_adv_vc_x64_custom.dll