About
testing.elasticsearch automatically setups a elasticsearch instance in a temporary directory, and destroys it after testing.
Install
Use pip:
$ pip install testing.elasticsearch6
And testing.elasticsearch6 requires Elasticsearch server in your PATH.
Usage
Create Elasticsearch instance using testing.elasticsearch.Elasticsearch:
import testing.elasticsearch
from sqlalchemy import create_engine
# Lanuch new Elasticsearch server
with testing.elasticsearch.Elasticsearch() as elasticsearch:
# connect to Elasticsearch (using elasticsearch-py)
es = Elasticsearch(**elasticsearch.dsn())
#
# do any tests using Elasticsearch...
#
# Elasticsearch server is terminated here
testing.elasticsearch.Elasticsearch generates temporary config files and data directories. On deleting Elasticsearch object, it terminates Elasticsearch instance and removes temporary files and directories.
If you want a database including indexes and any fixtures for your apps, use copy_data_from keyword:
# uses a copy of specified data directory of Elasticsearch. elasticsearch = testing.elasticsearch.Elasticsearch(copy_data_from='/path/to/your/index')
For example, you can setup new Elasticsearch server for each testcases on setUp() method:
import unittest
import testing.elasticsearch
class MyTestCase(unittest.TestCase):
def setUp(self):
self.elasticsearch = testing.elasticsearch.Elasticsearch()
def tearDown(self):
self.elasticsearch.stop()
Requirements
Python 2.7, 3.6
License
Apache License 2.0
History
1.0.0 (2016-08-20)
Drop python 2.6, 3.2 support
Depend on testing.common.database >= 2.0.0
Set booting timeout to 20sec
Fix bugs:
#1: find_elasticsearch_yaml_path() does not refer elasticsearch_home argument
#2: Make ES_PATH absolute
0.9.1 (2016-02-04)
Depend on testing.common.database package
0.9.0 (2015-12-13)
First release
Metadata
Release files for testing.elasticsearch6 1.1.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.elasticsearch6-1.1.0.tar.gz | 10.2 kB | Without provenance | Details for testing.elasticsearch6-1.1.0.tar.gz |
Release files / testing.elasticsearch6-1.1.0.tar.gz
| Download URL | testing.elasticsearch6-1.1.0.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
889d77ab28195273393ba083134d143520a261f22b0079bae466594fe72a51b9
|
|
BLAKE2b-256 checksum How to use checksums |
14fc1786a241a773c4003bcf3497959c48150330ea304422469cc1190a80e280
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for testing.elasticsearch6 1.1.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.