tk0miya / testing.postgresql

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

testing.postgresql not working

techemmy opened this issue · comments

Traceback (most recent call last):
File "C:\Users\Oloyede Emmanuel\Documents\Hook\tests.py", line 42, in setUp
with testing.postgresql.Postgresql() as postgresql:
File "C:\Users\Oloyede Emmanuel\Documents\Hook\env\lib\site-packages\testing\common\database.py", line 92, in init
self.initialize()
File "C:\Users\Oloyede Emmanuel\Documents\Hook\env\lib\site-packages\testing\postgresql.py", line 50, in initialize
self.initdb = find_program('initdb', ['bin'])
File "C:\Users\Oloyede Emmanuel\Documents\Hook\env\lib\site-packages\testing\postgresql.py", line 144, in find_program
raise RuntimeError("command not found: %s" % name)
RuntimeError: command not found: initdb

I don't think this is a bug with this package. I have seen this before and fixed it by making sure that I had all the necessary PostgreSQL packages installed and then making sure that the path to initdb is included in the PATH environment variable.

$ sudo apt install postgresql postgresql-contrib
$ export PATH=$PATH:/usr/lib/postgresql/10/bin

I have PostgreSQL running, but I get the same error when trying to use testing.postgresql. Actually, the tests pass when I use the regural PostgreSQL database, but fail when trying to use the library.

It seems to have to do with Windows administrator permissions too, even if you have PostgreSQL installed and on your path: https://stackoverflow.com/questions/70249381/python-testing-postgresql-error-the-program-postgres-is-needed-by-initdb