pytest_dbfixtures.factories¶
Groups factories to be importable from one place.
Redis factories¶
pytest_dbfixtures.factories.redis.
redis_proc
(executable=None, params=None, config_file=None, host=None, port=None, logs_prefix='')[source]¶Redis process factory.
Parameters:
- executable (str) – path to redis-server
- params (str) – params
- config_file (str) – path to config file
- host (str) – hostname
- port (str) –
exact port (e.g. ‘8000’) or randomly selected port:
‘?’ - any random available port ‘2000-3000’ - random available port from a given range ‘4002,4003’ - random of 4002 or 4003 ports- logs_prefix (str) – prefix for log filename
Return type: func
Returns: function which makes a redis process
pytest_dbfixtures.factories.redis.
redisdb
(process_fixture_name, db=None, strict=True)[source]¶Redis database factory.
Parameters:
- process_fixture_name (str) – name of the process fixture
- db (int) – number of database
- strict (bool) – if true, uses StrictRedis client class
Return type: func
Returns: function which makes a connection to redis
Mongo factories¶
pytest_dbfixtures.factories.mongo.
mongo_proc
(executable=None, params=None, host=None, port=None, logs_prefix='')[source]¶Mongo process factory.
Parameters:
- executable (str) – path to mongod
- params (str) – params
- host (str) – hostname
- port (str) –
exact port (e.g. ‘8000’) or randomly selected port:
‘?’ - any random available port ‘2000-3000’ - random available port from a given range ‘4002,4003’ - random of 4002 or 4003 ports- logs_prefix (str) – prefix for log filename
Return type: func
Returns: function which makes a mongo process
Postgresql factories¶
pytest_dbfixtures.factories.postgresql.
postgresql
(process_fixture_name, db=None)[source]¶postgresql database factory.
Parameters:
- process_fixture_name (str) – name of the process fixture
- db (int) – database name
Return type: func
Returns: function which makes a connection to postgresql
pytest_dbfixtures.factories.postgresql.
postgresql_proc
(executable=None, host=None, port=None, logs_prefix='')[source]¶postgresql process factory.
Parameters:
- executable (str) – path to postgresql_ctl
- host (str) – hostname
- port (str) –
exact port (e.g. ‘8000’) or randomly selected port:
‘?’ - any random available port ‘2000-3000’ - random available port from a given range ‘4002,4003’ - random of 4002 or 4003 ports- logs_prefix (str) – prefix for log filename
Return type: func
Returns: function which makes a postgresql process
Mysql factories¶
pytest_dbfixtures.factories.mysql.
mysql_proc
(executable=None, admin_executable=None, init_executable=None, host=None, port=None, params=None, logs_prefix='')[source]¶Mysql server process factory.
Parameters:
- executable (str) – path to mysql executable
- admin_executable (str) – path to mysql_admin executable
- init_executable (str) – path to mysql_init executable
- host (str) – hostname
- port (str) –
exact port (e.g. ‘8000’) or randomly selected port:
‘?’ - any random available port ‘2000-3000’ - random available port from a given range ‘4002,4003’ - random of 4002 or 4003 ports- params (str) – additional command-line mysqld parameters
- logs_prefix (str) – prefix for log filename
Return type: func
Returns: function which makes a redis process
Elasticsearch factories¶
pytest_dbfixtures.factories.elasticsearch.
elasticsearch_proc
(host='127.0.0.1', port=9201, cluster_name=None, network_publish_host='127.0.0.1', discovery_zen_ping_multicast_enabled=False, index_store_type='memory', logs_prefix='')[source]¶Creates elasticsearch process fixture.
Warning
This fixture requires at least version 1.0 of elasticsearch to work.
Parameters:
- host (str) – host that the instance listens on
- port (int|str) –
exact port that the instance listens on (e.g. 8000), or randomly selected port:
‘?’ - any random available port ‘2000-3000’ - random available port from a given range ‘4002,4003’ - random of 4002 or 4003 ports- cluster_name (str) – name of a cluser this node should work on. Used for autodiscovery. By default each node is in it’s own cluser.
- network_publish_host (str) – host to publish itself within cluser http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-network.html
- discovery_zen_ping_multicast_enabled (bool) – whether to enable or disable host discovery http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-zen.html
- index_store_type (str) – index.store.type setting. memory by default to speed up tests
- logs_prefix (str) – prefix for log filename