dbfixtures plugin for py.test.
Project description
py.test clean fixtures: mysql, redis, mongo, rabbitmq
Starts specific database deamon and cleanup all data produced during tests.
Install
$ pip install pytest-dbfixtures
How to use
def test_using_mysql(mysqldb):
cursor = mysqldb.cursor()
cursor.execute("SELECT CURRENT_USER()")
def test_using_redis(redisdb):
redisdb.set('woof', 'woof')
redisdb.get('woof')
def test_using_mongo(mongodb):
mongodb.test.insert({'woof': 'woof'})
mongodb.test.find_one()
def test_using_rabbit(rabbitmq):
channel = rabbitmq.channel()
Use your own configure files
Of course you can! Below you can see example configs.
pytest_dbfixtures/dbfixtures.conf
pytest_dbfixtures/redis.conf
pytest_dbfixtures/mongo.conf
pytest_dbfixtures/rabbit.conf
If you want to use your own configs pass them as arguments to py.test.
Examples:
py.test --dbfixtures-config my-dbfixtures.conf py.test --dbfixtures-config my-dbfixtures.conf --mongo-config my-mongo.conf py.test --redis-config my-redis.conf py.test --rabbit-config my-rabbit.conf
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for pytest-dbfixtures-0.3.6.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46563436e3b23e7d2ed60203fa1678cf8cb32056379039a3160010a3e59b3878 |
|
MD5 | 7a97915aec6382d66e68ae348e14d14c |
|
BLAKE2b-256 | 0de4e6e48628aa21b64c87027e75028ba9fef1b84c075cfa430de6c15e9ef503 |