Skip to content

Commit 3fd8076

Browse files
committed
Added travis and readthedocs support
1 parent a7fb596 commit 3fd8076

File tree

5 files changed

+61
-30
lines changed

5 files changed

+61
-30
lines changed

.travis.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
language: python
2+
python:
3+
- "2.6"
4+
- "2.7"
5+
6+
# command to install dependencies
7+
install:
8+
- python bootstrap.py -v 2.1.1
9+
- bin/buildout
10+
11+
# command to run tests
12+
script:
13+
bin/test etcd.tests.unit
14+
15+
# Only test main development branch and releases
16+
branches:
17+
only:
18+
- master
19+
- /^release_.*$/

README.rst

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ python-etcd documentation
33

44
A python client for Etcd https://github.com/coreos/etcd
55

6+
Official documentation: http://python-etcd.readthedocs.org/
7+
8+
.. image:: https://api.travis-ci.org/jplana/python-etcd.png
9+
:target: https://travis-ci.org/jplana/python-etcd
10+
611
Installation
712
------------
813

docs-source/conf.py

+24-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
# -*- coding: utf-8 -*-
2-
#
3-
# python-etcd documentation build configuration file, created by
4-
# sphinx-quickstart on Sat Sep 14 15:58:06 2013.
5-
#
6-
# This file is execfile()d with the current directory set to its containing dir.
7-
#
8-
# Note that not all possible configuration values are present in this
9-
# autogenerated file.
10-
#
11-
# All configuration values have a default; values that are commented out
12-
# serve to show the default.
132

143
import sys, os
154

5+
class Mock(object):
6+
def __init__(self, *args, **kwargs):
7+
pass
8+
9+
def __call__(self, *args, **kwargs):
10+
return Mock()
11+
12+
@classmethod
13+
def __getattr__(cls, name):
14+
if name in ('__file__', '__path__'):
15+
return '/dev/null'
16+
elif name[0] == name[0].upper():
17+
mockType = type(name, (), {})
18+
mockType.__module__ = __name__
19+
return mockType
20+
else:
21+
return Mock()
22+
23+
MOCK_MODULES = ['urllib3']
24+
for mod_name in MOCK_MODULES:
25+
sys.modules[mod_name] = Mock()
26+
1627
# If extensions (or modules to document with autodoc) are in another directory,
1728
# add these directories to sys.path here. If the directory is relative to the
1829
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -48,9 +59,9 @@
4859
# built documents.
4960
#
5061
# The short X.Y version.
51-
version = '0.1'
62+
version = '0.2'
5263
# The full version, including alpha/beta/rc tags.
53-
release = '0.1'
64+
release = '0.2.0'
5465

5566
# The language for content autogenerated by Sphinx. Refer to documentation
5667
# for a list of supported languages.

docs-source/index.rst

+13-13
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Install etcd
1818
From source
1919
...........
2020

21-
.. code:: bash
21+
.. code-block:: bash
2222
2323
$ python setup.py install
2424
@@ -29,7 +29,7 @@ Usage
2929
Create a client object
3030
......................
3131

32-
.. code:: python
32+
.. code-block:: python
3333
3434
import etcd
3535
@@ -42,7 +42,7 @@ Create a client object
4242
Set a key
4343
.........
4444

45-
.. code:: python
45+
.. code-block:: python
4646
4747
client.set('/nodes/n1', 1)
4848
# with ttl
@@ -51,39 +51,39 @@ Set a key
5151
Get a key
5252
.........
5353

54-
.. code:: python
54+
.. code-block:: python
5555
5656
client.get('/nodes/n2').value
5757
5858
5959
Delete a key
6060
............
6161

62-
.. code:: python
62+
.. code-block:: python
6363
6464
client.delete('/nodes/n1')
6565
6666
6767
Test and set
6868
............
6969

70-
.. code:: python
70+
.. code-block:: python
7171
7272
client.test_and_set('/nodes/n2', 2, 4) # will set /nodes/n2 's value to 2 only if its previous value was 4
7373
7474
7575
Watch a key
7676
...........
7777

78-
.. code:: python
78+
.. code-block:: python
7979
8080
client.watch('/nodes/n1') # will wait till the key is changed, and return once its changed
8181
8282
8383
List sub keys
8484
.............
8585

86-
.. code:: python
86+
.. code-block:: python
8787
8888
# List nodes in the cluster
8989
client.get('/nodes')
@@ -95,15 +95,15 @@ List sub keys
9595
Get machines in the cluster
9696
...........................
9797

98-
.. code:: python
98+
.. code-block:: python
9999
100100
client.machines
101101
102102
103103
Get leader of the cluster
104104
.........................
105105

106-
.. code:: python
106+
.. code-block:: python
107107
108108
client.leader
109109
@@ -115,21 +115,21 @@ Development setup
115115

116116
To create a buildout,
117117

118-
.. code:: bash
118+
.. code-block:: bash
119119
120120
$ python bootstrap.py
121121
$ bin/buildout
122122
123123
124124
to test you should have etcd available in your system path:
125125

126-
.. code:: bash
126+
.. code-block:: bash
127127
128128
$ bin/test
129129
130130
to generate documentation,
131131

132-
.. code:: bash
132+
.. code-block:: bash
133133
134134
$ cd docs
135135
$ make

src/etcd/tests/unit/__init__.py

-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
import test_client
22
import test_request
3-
4-
5-
def test_suite():
6-
return unittest.makeSuite([test_client.TestClient])

0 commit comments

Comments
 (0)