Open dtracers opened 5 years ago
Im getting the same problem.. Whenever I try to create a connection to the fake DB when imported as a fixture I get the error
This was perplexing for me too, as this works on and off on slight modifications, without good reason. Although I was using the Postgresql
class not the factory, a fellow coworker pointed out to try to pass the port that the error refers to:
psycopg2.OperationalError: connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
And what solved the problem for me (although it worked at times):
pg = testing.postgresql.Postgresql(
port=5432,
postgres_args="-h 127.0.0.1 -F -c logging_collector=off -c max_locks_per_transaction=200",
)
No idea why.
I am using python 3.7 and postgresql
I have these as pytest fixtures and when it tries to recreate them the first query throws a connection refused error.