diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..cbb6b7f8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: python +python: + - "2.6" + - "2.7" + +# command to install dependencies +install: + - python bootstrap.py -v 2.1.1 + - bin/buildout + +# command to run tests +script: + bin/test etcd.tests.unit + +# Only test main development branch and releases +branches: + only: + - master + - /^release_.*$/ diff --git a/README.rst b/README.rst index 2e2e3b3d..bcb6a51b 100644 --- a/README.rst +++ b/README.rst @@ -3,6 +3,11 @@ python-etcd documentation A python client for Etcd https://github.com/coreos/etcd +Official documentation: http://python-etcd.readthedocs.org/ + +.. image:: https://api.travis-ci.org/jplana/python-etcd.png + :target: https://travis-ci.org/jplana/python-etcd + Installation ------------ diff --git a/docs-source/conf.py b/docs-source/conf.py index 8a9f3327..dfb095ac 100644 --- a/docs-source/conf.py +++ b/docs-source/conf.py @@ -1,18 +1,29 @@ # -*- coding: utf-8 -*- -# -# python-etcd documentation build configuration file, created by -# sphinx-quickstart on Sat Sep 14 15:58:06 2013. -# -# This file is execfile()d with the current directory set to its containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. import sys, os +class Mock(object): + def __init__(self, *args, **kwargs): + pass + + def __call__(self, *args, **kwargs): + return Mock() + + @classmethod + def __getattr__(cls, name): + if name in ('__file__', '__path__'): + return '/dev/null' + elif name[0] == name[0].upper(): + mockType = type(name, (), {}) + mockType.__module__ = __name__ + return mockType + else: + return Mock() + +MOCK_MODULES = ['urllib3'] +for mod_name in MOCK_MODULES: + sys.modules[mod_name] = Mock() + # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. @@ -48,9 +59,9 @@ # built documents. # # The short X.Y version. -version = '0.1' +version = '0.2' # The full version, including alpha/beta/rc tags. -release = '0.1' +release = '0.2.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs-source/index.rst b/docs-source/index.rst index f7d0a70e..bcf7c75c 100644 --- a/docs-source/index.rst +++ b/docs-source/index.rst @@ -18,7 +18,7 @@ Install etcd From source ........... -.. code:: bash +.. code-block:: bash $ python setup.py install @@ -29,7 +29,7 @@ Usage Create a client object ...................... -.. code:: python +.. code-block:: python import etcd @@ -42,7 +42,7 @@ Create a client object Set a key ......... -.. code:: python +.. code-block:: python client.set('/nodes/n1', 1) # with ttl @@ -51,7 +51,7 @@ Set a key Get a key ......... -.. code:: python +.. code-block:: python client.get('/nodes/n2').value @@ -59,7 +59,7 @@ Get a key Delete a key ............ -.. code:: python +.. code-block:: python client.delete('/nodes/n1') @@ -67,7 +67,7 @@ Delete a key Test and set ............ -.. code:: python +.. code-block:: python client.test_and_set('/nodes/n2', 2, 4) # will set /nodes/n2 's value to 2 only if its previous value was 4 @@ -75,7 +75,7 @@ Test and set Watch a key ........... -.. code:: python +.. code-block:: python client.watch('/nodes/n1') # will wait till the key is changed, and return once its changed @@ -83,7 +83,7 @@ Watch a key List sub keys ............. -.. code:: python +.. code-block:: python # List nodes in the cluster client.get('/nodes') @@ -95,7 +95,7 @@ List sub keys Get machines in the cluster ........................... -.. code:: python +.. code-block:: python client.machines @@ -103,7 +103,7 @@ Get machines in the cluster Get leader of the cluster ......................... -.. code:: python +.. code-block:: python client.leader @@ -115,7 +115,7 @@ Development setup To create a buildout, -.. code:: bash +.. code-block:: bash $ python bootstrap.py $ bin/buildout @@ -123,13 +123,13 @@ To create a buildout, to test you should have etcd available in your system path: -.. code:: bash +.. code-block:: bash $ bin/test to generate documentation, -.. code:: bash +.. code-block:: bash $ cd docs $ make diff --git a/src/etcd/tests/unit/__init__.py b/src/etcd/tests/unit/__init__.py index 8a7a9cb6..1e35a7fc 100644 --- a/src/etcd/tests/unit/__init__.py +++ b/src/etcd/tests/unit/__init__.py @@ -1,6 +1,2 @@ import test_client import test_request - - -def test_suite(): - return unittest.makeSuite([test_client.TestClient])