Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Fixture to bring up temporary pgbouncer instance.

Project Description

Copyright (c) 2011, Canonical Ltd

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <>.

python-pgbouncer provides a python interface to setup and run a pgbouncer instance.

Testing Dependencies

In addition to the above, the tests also depend on:


Create a PGBouncerFixture - a context manager with an extended protocol supporting access to logs etc. Customise it with database definitions, user credentials, and then when you enter the context it will create a transient pgbouncer setup in a temporary directory and run it for the duration that the context is open.

For instance:

>>> from pgbouncer import PGBouncerFixture
>>> bouncer = PGBouncerFixture()
>>> bouncer.databases['mydb'] = 'host=hostname dbname=foo'
>>> bouncer.users['user1'] = 'credentials'
>>> with bouncer:
...     # Can now connect to port=bouncer.port user=user1

Any settings required for pgbouncer to work will be given sane defaults.


Either run in an environment with all the dependencies available, or add the working directory to your PYTHONPATH.


Upstream development takes place at To setup a working area for development, if the dependencies are not immediately available, you can use ./ to create bin/buildout, then bin/py to get a python interpreter with the dependencies available.

To run the tests, run either:

$ bin/py pgbouncer/


$ bin/py -m pgbouncer.tests.test_suite

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(5.8 kB) Copy SHA256 Hash SHA256
Source None Aug 20, 2012

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers