Metadata-Version: 2.4
Name: osmem-server
Version: 0.1.1
Summary: In-memory OpenSearch-compatible server for tests (osmem-server launcher, pytest fixtures)
License-Expression: MIT
Project-URL: Repository, https://github.com/shibukawa/osmem
Keywords: opensearch,elasticsearch,testing,pytest,in-memory
Classifier: Framework :: Pytest
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# osmem-server

In-memory OpenSearch-compatible server for tests (`pip install osmem-server`).
The wheel bundles the `osmem-server` binary for your platform; no Docker,
no JVM. The import name is `osmem_server`.

```python
# pytest.ini / pyproject.toml
[tool.pytest.ini_options]
osmem_seed = ["testdata/seed"]
```

```python
from opensearchpy import OpenSearch

def test_search(osmem_clone):
    client = OpenSearch(hosts=[osmem_clone.url])
    client.index(index="products", id="x", body={"name": "new"}, refresh=True)
    assert client.count(index="products")["count"] == 6
```

Each test gets its own clone of the seeded base cluster (milliseconds,
copy-on-write); the server itself starts once per session and exits with
the test process. Without pytest:

```python
from osmem_server import OsmemServer

with OsmemServer.start(seed=["testdata/seed"]) as server, server.clone() as clone:
    ...
```

Set `OSMEM_SERVER_BIN` to use a locally built binary. Seed layout and the
management API are documented in the
[osmem repository](https://github.com/shibukawa/osmem).

Full guide: [English](https://shibukawa.github.io/osmem/python/) · [日本語](https://shibukawa.github.io/osmem/ja/python/)
