Skip to content

Commit

Permalink
Added travis and readthedocs support
Browse files Browse the repository at this point in the history
  • Loading branch information
jplana committed Sep 30, 2013
1 parent a7fb596 commit 3fd8076
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 30 deletions.
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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_.*$/
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------

Expand Down
37 changes: 24 additions & 13 deletions docs-source/conf.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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.
Expand Down
26 changes: 13 additions & 13 deletions docs-source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Install etcd
From source
...........

.. code:: bash
.. code-block:: bash
$ python setup.py install
Expand All @@ -29,7 +29,7 @@ Usage
Create a client object
......................

.. code:: python
.. code-block:: python
import etcd
Expand All @@ -42,7 +42,7 @@ Create a client object
Set a key
.........

.. code:: python
.. code-block:: python
client.set('/nodes/n1', 1)
# with ttl
Expand All @@ -51,39 +51,39 @@ Set a key
Get a key
.........

.. code:: python
.. code-block:: python
client.get('/nodes/n2').value
Delete a key
............

.. code:: python
.. code-block:: python
client.delete('/nodes/n1')
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
Watch a key
...........

.. code:: python
.. code-block:: python
client.watch('/nodes/n1') # will wait till the key is changed, and return once its changed
List sub keys
.............

.. code:: python
.. code-block:: python
# List nodes in the cluster
client.get('/nodes')
Expand All @@ -95,15 +95,15 @@ List sub keys
Get machines in the cluster
...........................

.. code:: python
.. code-block:: python
client.machines
Get leader of the cluster
.........................

.. code:: python
.. code-block:: python
client.leader
Expand All @@ -115,21 +115,21 @@ Development setup

To create a buildout,

.. code:: bash
.. code-block:: bash
$ python bootstrap.py
$ bin/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
Expand Down
4 changes: 0 additions & 4 deletions src/etcd/tests/unit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
import test_client
import test_request


def test_suite():
return unittest.makeSuite([test_client.TestClient])

0 comments on commit 3fd8076

Please sign in to comment.