Each RabbitMQ process fixture can be configured in a different way than the others through the fixture factory arguments.

Configuration

You can define your settings in three ways, it’s fixture factory argument, command line option and pytest.ini configuration option.
You can pick which you prefer, but remember that these settings are handled in the following order:

Fixture factory argument

Command line option

Configuration option in your pytest.ini file

Redis server option

Fixture factory argument

Command line option

pytest.ini option

Default

executable

executable

–redis-exec

redis_exec

/usr/bin/redis-server

host

host

–redis-host

redis_host

127.0.0.1

port

port

–redis-port

redis_port

random

connection timeout

timeout

–redis-timeout

redis_timeout

30

number of databases

db_count

–redis-db-count

redis_db_count

8

Whether to enable logging
to the system logger

syslog

–redis-syslog

redis_syslog

False

Log directory location

logsdir

–redis-logsdir

redis_logsdir

$TMPDIR

Redis log verbosity level

loglevel

–redis-loglevel

redis_loglevel

notice

Compress dump files

compress

–redis-compress

redis_compress

True

Add checksum to RDB files

checksum

–redis-rdbcompress

redis_rdbchecksum

False

Save configuration

save

–redis-save

redis_save

“”

Example usage:

pass it as an argument in your own fixture

redis_proc=factories.redis_proc(port=8888)

use --redis-port command line option when you run your tests

py.test tests --redis-port=8888

specify your port as redis_port in your pytest.ini file.

To do so, put a line like the following under the [pytest] section of your pytest.ini: