Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Databases fixtures plugin for py.test.

Project description


Latest PyPI version Documentation Status Number of PyPI downloads Wheel Status Egg Status License

Package status

Tests Coverage Status Requirements Status


py.test clean fixtures for: postgresql, mysql, redis, mongo, elasticsearch and rabbitmq.

Starts specific database deamon and cleanup all data produced during tests.


$ pip install --upgrade pytest-dbfixtures

How to use

Please see documentation



  • fix W503 pep8 errors, that appeared after new pylama got released
  • update to be able to use pytest-dbfixtures with pymongo 3
  • ability to properly use also beta versions of postgresql releases. (previously only stable versions were targeted)


  • add ability to set custom location for logs (might be useful for analysing logs from tests)
  • added postgresql 9.4 to supported versions.


  • Use port number in default RabbitMQ node name.

    This allows using just the port=’?’ argument to rabbitmq_proc to run multiple independent RabbitMQ instances for use with xdist to parallelize tests on a single machine.

  • Old versions of Redis notification

    displays a message about old version of redis


  • Feature: random ports selection Adds a possibility of passing ‘?’ in port= argument of process fixtures.
  • Removes ‘port’ from db fixtures
  • Fixes postgres missing host - previously using config.postgresql.unixsocketdir


  • redisdb fixture allows to specify client connection class
  • redisdb fixture uses now StrictRedis by default (backward incompatible)


  • replaced MySQLdb with it’s fork mysqlclient - compatibility with python3
  • renamed mysqldb fixture to mysql to keep it consistent with other client fixtures.
  • replaced pika with python 3 compatible rabbitpy
  • removed deprecated mysqldb_session/mysql_session
  • bugfix of rabbitmq fixture: cast rabbitmq queues and exchanges to str due to pamq having problems
  • internal changes: removed GentleKillingExecutor as mirakuru already implements same functionality


  • syntax fixes for python 3
  • moved postgresql starting code into it’s own executor
  • xdist distributed hosts testing bugfix (but xdist parallelization on one host won’t work)


  • make rabbitmq logs persistent


  • update mirakuru to min 0.2
  • os.killpg to terminate process
  • add tests coverage on coveralls


  • remove creating old RABBITMQ env variables


  • remove elasticsearch home folder at process teardown
  • set elasticsearch to memory by default
  • localized elasticsearch instance by default
  • replaced summon_process with mirakuru


  • RabbitMQ process fixture is session scoped
  • rabbitmq fixture factory accepts custom teardown


  • StopRunningExecutor to simply return if process had been already killed.


  • MongoDB fixtures can be now initialized by factories


  • Bugfix: params in redis fixture


  • Add params to mysql fixture


  • Client fixtures now check if process (process fixture) is running before every test and starts process if it was terminated after previous test.


  • Bugfix: Now we don’t overwrite postgresql config in postgres_proc


  • Bugfix of rabbitmq_proc fixture - now it works with scope=function


  • Overrides SimpleExecutor’s behavior with a try of more gentle terminating subprocess before killing it.
  • Deprecate scope for mysqldb fixture and change it to function by default.
  • RabbitMQ factories support (multiple rabbit fixtures).


  • Postgresql multiple versions proper support
  • Default timeouts and waits for process executors


  • introduced Elasticsearch fixture


  • mysql fixture now uses factories


  • postgresql fixtures and fixture factories
  • small code quality improvements
  • pylama code check


  • splits rabbitmq fixture into process/client fixtures

Project details

Download files

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

Files for pytest-dbfixtures, version 0.10.0
Filename, size File type Python version Upload date Hashes
Filename, size pytest_dbfixtures-0.10.0-py2-none-any.whl (33.9 kB) File type Wheel Python version 2.7 Upload date Hashes View
Filename, size pytest_dbfixtures-0.10.0-py3-none-any.whl (33.9 kB) File type Wheel Python version 3.3 Upload date Hashes View
Filename, size pytest-dbfixtures-0.10.0.tar.gz (17.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page