Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/criteo-forks/testing.cassandra
testing.cassandra3: fork of testing.cassandra with Python 3 and Cassandra 3 support
https://github.com/criteo-forks/testing.cassandra
cassandra python3 testing
Last synced: 14 days ago
JSON representation
testing.cassandra3: fork of testing.cassandra with Python 3 and Cassandra 3 support
- Host: GitHub
- URL: https://github.com/criteo-forks/testing.cassandra
- Owner: criteo-forks
- License: apache-2.0
- Fork: true (tk0miya/testing.cassandra)
- Created: 2017-12-06T16:21:00.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-14T15:32:29.000Z (about 7 years ago)
- Last Synced: 2025-01-03T12:46:32.091Z (about 1 month ago)
- Topics: cassandra, python3, testing
- Language: Python
- Homepage:
- Size: 71.3 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
``testing.cassandra3`` automatically setups a cassandra instance in a temporary directory, and destroys it after testing
.. image:: https://travis-ci.org/criteo-forks/testing.cassandra.svg?branch=master
:target: https://travis-ci.org/criteo-forks/testing.cassandra.. image:: https://coveralls.io/repos/criteo-forks/testing.cassandra/badge.png?branch=master
:target: https://coveralls.io/r/criteo-forks/testing.cassandra?branch=master.. image:: https://codeclimate.com/github/criteo-forks/testing.cassandra/badges/gpa.svg
:target: https://codeclimate.com/github/criteo-forks/testing.cassandraThis is a fork of https://github.com/tk0miya/testing.cassandra.
Install
=======
Use easy_install (or pip)::$ easy_install testing.cassandra3
And ``testing.cassandra3`` requires Cassandra server.
Usage
=====
Create Cassandra instance using ``testing.cassandra3.Cassandra``::import cassandra
import testing.cassandra3# Launch new Cassandra server
with testing.cassandra3.Cassandra as cassandra:
conn = cassandra.cluster.Cluster(**cassandra.connection_params())
#
# do any tests using Cassandra...
## Cassandra server is terminated here
``testing.cassandra3`` 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.cassandra3.Cassandra(copy_data_from='/path/to/your/database')``testing.cassandra3.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.cassandra3.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.cassandra3.Cassandra(cassandra_yaml={'rpc_port': 12345})For example, you can setup new Cassandra server for each testcases on setUp() method::
import unittest
import testing.cassandra3class MyTestCase(unittest.TestCase):
def setUp(self):
self.cassandra = testing.cassandra3.Cassandra()def tearDown(self):
self.cassandra.stop()Requirements
============
* Cassandra 3.11.1
* Python 2.7, 3.5, 3.6
* cassandra-driver
* PyYAMLLicense
=======
Apache License 2.0History
=======1.3.0 (2017-12-10)
------------------
* Fork testing.cassandra
* Drop support for Cassandra 2.x and Python 2.6
* Add support for Cassandra 3.x and Python 31.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`` package1.1.4 (2015-04-06)
-------------------
* Fix bugs:- Do not call os.getpid() on destructor (if not needed)
- Use absolute path for which command1.1.3 (2014-06-19)
-------------------
* Add timeout on terminating cassandra
* Fix bugs1.1.2 (2014-06-11)
-------------------
* Fix ImportError if caught SIGINT on py31.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 started1.0.0 (2013-10-17)
-------------------
* First release