kazoo.testing.harness

Kazoo testing harnesses

Public API

class kazoo.testing.harness.KazooTestHarness(*args, **kw)[source]

Harness for testing code that uses Kazoo

This object can be used directly or as a mixin. It supports starting and stopping a complete ZooKeeper cluster locally and provides an API for simulating errors and expiring sessions.

Example:

class MyTestCase(KazooTestHarness):
    def setUp(self):
        self.setup_zookeeper()

        # additional test setup

    def tearDown(self):
        self.teardown_zookeeper()

    def test_something(self):
        something_that_needs_a_kazoo_client(self.client)

    def test_something_else(self):
        something_that_needs_zk_servers(self.servers)
class kazoo.testing.harness.KazooTestCase(*args, **kw)[source]