testing.elasticsearch
testing.elasticsearch automatically sets up an elasticsearch instance in a temporary directory, and destroys it after testing. It’s useful as a pytest fixture for testing interactions with elasticsearch in an isolated manner.
Implementation is based off the awesome testing.redis module.
Example usage:
import testing.elasticsearch
import pyes.es import ES
# launch new elasticsearch server:
with testing.elasticsearch.ElasticSearchServer() es:
elasticsearch = ES(es.uri())
# perform any testing with elasticsearch here
# elasticsearch server is terminated and cleaned up here
You can change the server configuration by specifying a config dict:
with ElasticSearchServer(config={
'logger.level': 'DEBUG',
# Keep index in memory
'index.store.type': 'mmapfs',
}) as es:
...
…or by setting them on the config attribute before starting the server:
es = ElasticSearchServer()
es.config['logger.level'] = 'DEBUG'
es.start()
You can also setup a pytest fixture:
@pytest.fixture(scope='session')
def elasticsearch(request):
"""
A testing fixture that provides a running elasticsearch server.
"""
es = ElasticSearchServer()
es.start()
request.addfinalizer(es.stop)
return es
Testing
To run tests you’ll need to install the test requirements:
pip install -r src/tests/requirements.txt
Run tests:
python src/tests/runtests.py
Metadata
Release files for testing.elasticsearch 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| testing.elasticsearch-0.3.0.tar.gz | 5.7 kB | Without provenance | Details for testing.elasticsearch-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| testing.elasticsearch-0.3.0-py2-none-any.whl | Python 2 | none | any | Details for testing.elasticsearch-0.3.0-py2-none-any.whl |
Total release size: 11.8 kB
Release files / testing.elasticsearch-0.3.0.tar.gz
| Download URL | testing.elasticsearch-0.3.0.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7a9065403ee07ec6d22f311369697bbc41141fffc218bf95b24e0c93b6a44f7
|
|
BLAKE2b-256 checksum How to use checksums |
1f3015cec34c92f602a05d1aab6a4b8c4b4a09521f7f1e14d21dd527cbdaa207
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / testing.elasticsearch-0.3.0-py2-none-any.whl
| Download URL | testing.elasticsearch-0.3.0-py2-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
db09fb9bcaec3a090abf025b7b2813b24839c35736c823324f249f09aaf6f682
|
|
BLAKE2b-256 checksum How to use checksums |
3862c65f6dca45f1ee47db691b4ff74906181c47d885f82bc7e4b3d580a188c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for testing.elasticsearch 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.