tk0miya / testing.postgresql

Apache License 2.0
290 stars 46 forks source link

testing.postgresql not working #35

Open techemmy opened 4 years ago

techemmy commented 4 years ago

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

monocongo commented 4 years ago

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
hugolvchf commented 2 years ago

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.

tshynik commented 2 years ago

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