Skip to main content

testing.cassandra automatically setups a cassandra instance in a temporary directory, and destroys it after testing

https://travis-ci.org/tk0miya/testing.cassandra.svg?branch=master https://coveralls.io/repos/tk0miya/testing.cassandra/badge.png?branch=master https://codeclimate.com/github/tk0miya/testing.cassandra/badges/gpa.svg

Install

Use easy_install (or pip):

$ easy_install testing.cassandra

And testing.cassandra requires Cassandra server.

Usage

Create Cassandra instance using testing.cassandra.Cassandra:

import pycassa
import testing.cassandra

# Launch new Cassandra server
with testing.cassandra.Cassandra as cassandra:
    conn = pycassa.pool.ConnectionPool('test', cassandra.server_list())
    #
    # do any tests using Cassandra...
    #

# Cassandra server is terminated here

testing.cassandra automatically searchs for cassandra files in /usr/local/. If you install cassandra to other directory, set cassandra_home keyword:

# uses a copy of specified data directory of Cassandra.
cassandra = testing.cassandra.Cassandra(copy_data_from='/path/to/your/database')

testing.cassandra.Cassandra executes cassandra on instantiation. On deleting Cassandra object, it terminates Cassandra instance and removes temporary directory.

If you want a database including column families and any fixtures for your apps, use copy_data_from keyword:

# uses a copy of specified data directory of Cassandra.
cassandra = testing.cassandra.Cassandra(copy_data_from='/path/to/your/database')

You can specify parameters for Cassandra with cassandra_yaml keyword:

# boot Cassandra server listens on 12345 port
cassandra = testing.cassandra.Cassandra(cassandra_yaml={'rpc_port': 12345})

For example, you can setup new Cassandra server for each testcases on setUp() method:

import unittest
import testing.cassandra

class MyTestCase(unittest.TestCase):
    def setUp(self):
        self.cassandra = testing.cassandra.Cassandra()

    def tearDown(self):
        self.cassandra.stop()

Requirements

  • Cassandra 1.1, 1.2, 2.0, 2.1, 2.2

  • Python 2.6, 2.7

  • pycassa

  • PyYAML

License

Apache License 2.0

History

1.2.0 (2016-02-03)

  • Add timeout to server invoker

  • Support Homebrew

  • Support Cassandra 2.x

  • Refer $CASSANDRA_HOME for search cassandra home directory

  • Depend on testing.common.database package

1.1.4 (2015-04-06)

  • Fix bugs:

    • Do not call os.getpid() on destructor (if not needed)

    • Use absolute path for which command

1.1.3 (2014-06-19)

  • Add timeout on terminating cassandra

  • Fix bugs

1.1.2 (2014-06-11)

  • Fix ImportError if caught SIGINT on py3

1.1.1 (2013-12-06)

  • Suport Cassandra 2.0.x

  • Fix Cassandra#stop() causes OSError (at destructing object)

1.1.0 (2013-12-06)

  • Support Cassandra 1.2.x

  • Support python 2.6

  • Add cassandra.skipIfNotInstalled decorator

  • Change behavior: Cassandra#stop() cleans workdir

  • Fix workdir does not removed if cassandra does not started

1.0.0 (2013-10-17)

  • First release

Metadata

Release files for testing.cassandra 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for testing.cassandra 1.2.0
File Size Uploaded Provenance
testing.cassandra-1.2.0.tar.gz 9.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for testing.cassandra 1.2.0
File Interpreter ABI Platform
testing.cassandra-1.2.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 16.9 kB

Release files / testing.cassandra-1.2.0.tar.gz

Download URL testing.cassandra-1.2.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1a0c93db79e896b8ac007a7b180b846154b2027385dddc9e6ab369b2a8badba9
BLAKE2b-256 checksum
How to use checksums
a44d675b6c2e953b352b47bffc5ee924dc1b2349820ad64d132f19a4b2bed95d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / testing.cassandra-1.2.0-py2.py3-none-any.whl

Download URL testing.cassandra-1.2.0-py2.py3-none-any.whl
Size 7.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e25ed34631a64cec27dcbf558afced3b080365eddfce5419145846fe0de66b0b
BLAKE2b-256 checksum
How to use checksums
e1c5a23adb0de08663dba326baa092b576e5c68b5eafa519e9c83b9c1d04224f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for testing.cassandra 1.2.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page