Skip to main content

RavenDB Test Driver

ravendb-test-driver runs your integration tests against a real RavenDB server instead of a mock. Each test gets its own isolated database, created on demand and torn down afterwards, so tests do not leak state into one another. You write ordinary ravendb client code; the driver handles the server and the per-test database lifecycle.

Install

pip install ravendb-test-driver

Python 3.10+ is required.

Providing a server: pick one

The driver needs a RavenDB server to talk to. There are two ways to give it one; choose based on whether you want .NET on the test machine.

1. Embedded server (default, needs .NET)

Out of the box the driver boots an embedded RavenDB server (via ravendb-embedded). Nothing to configure, but the embedded server is a .NET application, so a matching runtime must be installed:

ravendb-test-driver version Required runtime
7.2.x .NET 10
7.1.x .NET 8

Check with dotnet --list-runtimes. The requirement tracks the embedded server and can change on a minor upgrade, so re-check it when you bump versions.

2. Attach to a server you run yourself (no .NET)

If you would rather not put .NET on the test machine (containerized CI, locked-down hosts), run RavenDB yourself (Docker, testcontainers, a shared CI service) and point the driver at its URL. The driver skips the embedded boot entirely and still creates an isolated database per test.

from ravendb_test_driver import RavenTestDriver

RavenTestDriver.configure_external_server("http://localhost:8080")
# or set RAVENDB_TEST_SERVER_URL in the environment (handy for CI)

Call it once, before the first get_document_store(). A runnable Docker / testcontainers guide is in labs/01-attach-to-server.md. For the embedded and self-contained server options, see the ravendb-python-embedded repository.

Usage

Subclass RavenTestDriver (or hold an instance) and call get_document_store() in each test to get a store backed by a fresh database:

from unittest import TestCase
from ravendb_test_driver import RavenTestDriver


class TestBasic(TestCase):
    def setUp(self):
        self.test_driver = RavenTestDriver()

    def test_stores_a_document(self):
        with self.test_driver.get_document_store() as store:   # isolated database
            with store.open_session() as session:
                session.store({"Name": "John"}, "people/1")
                session.save_changes()

Runnable example: labs/02-embedded-per-test.md.

Seeding data and waiting for indexes

  • Override setup_database(self, store) to seed or configure every database the driver hands out (indexes, reference data, and so on).
  • get_document_store(options) accepts GetDocumentStoreOptions; set a wait_for_indexing_timeout to block until indexing settles, or call wait_for_indexing(store) yourself.
  • wait_for_user_to_continue_the_test(store) opens RavenDB Studio so you can inspect the data mid-test.

Runnable example: labs/03-seeding-indexes.md.

Links

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ravendb_test_driver-7.2.5.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ravendb_test_driver-7.2.5-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file ravendb_test_driver-7.2.5.tar.gz.

File metadata

  • Download URL: ravendb_test_driver-7.2.5.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for ravendb_test_driver-7.2.5.tar.gz
Algorithm Hash digest
SHA256 d186f8e519f006cf9baa7c9d253b0482f315881e689b474f3790ab215d46e621
MD5 9acfc102891ee9d3b19a9a7ea3c93c70
BLAKE2b-256 aabefacef6b6d8aa5d5d51201186404c6446c528a7579ae971c2c3d467e7d3ac

See more details on using hashes here.

File details

Details for the file ravendb_test_driver-7.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for ravendb_test_driver-7.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 de2d776b3f55338fdc23258bc01e138bbaca34f5486cf0018d01aad6335514bc
MD5 c67e3696af627046f67bbdadcd7ba42b
BLAKE2b-256 be5adbc2e419bf5a161706f8989952a24ae37202be74af4651507a06ebbb0c8b

See more details on using hashes here.

Release history Release notifications | RSS feed

7.2.5.post2

2 files

7.2.5.post1

2 files

This release

7.2.5 This release

2 files

7.2.3

2 files

7.2.2

2 files

7.2.1

2 files

7.2.0

2 files

7.1.5

2 files

7.1.4

2 files

7.1.3

2 files

7.1.2.post1

2 files

7.1.2

2 files

7.0.2

2 files

7.0.0

2 files

6.2.4

2 files

6.0.0.post6

2 files

6.0.0.post5

2 files

6.0.0.post4

2 files

6.0.0.post3

2 files

6.0.0.post2

2 files

6.0.0.post1

2 files

6.0

3 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page