Add tox targets that run tests with etcd

This commit is contained in:
Davanum Srinivas 2017-03-25 10:24:37 -04:00
parent c362cd4eb1
commit 6199d5bec5
4 changed files with 25 additions and 1 deletions

View File

@ -6,7 +6,9 @@ services:
env: env:
- TOXENV=pep8 - TOXENV=pep8
- TOXENV=py27 - TOXENV=py27
- TOXENV=py27-etcd
- TOXENV=py35 - TOXENV=py35
- TOXENV=py35-etcd
- TOXENV=cover - TOXENV=cover
- TOXENV=docs - TOXENV=docs
- TOXENV=examples - TOXENV=examples

View File

@ -17,11 +17,24 @@ test_etcd3-gateway
Tests for `etcd3gw` module. Tests for `etcd3gw` module.
""" """
from testtools.testcase import unittest
import urllib3
from etcd3gw.client import Client from etcd3gw.client import Client
from etcd3gw.tests import base from etcd3gw.tests import base
def _is_etcd3_running():
try:
urllib3.PoolManager().request('GET', '127.0.0.1:2379')
return True
except urllib3.exceptions.HTTPError:
return False
class TestEtcd3Gateway(base.TestCase): class TestEtcd3Gateway(base.TestCase):
@unittest.skipUnless(
_is_etcd3_running(), "etcd3 is not available")
def test_something(self): def test_something(self):
client = Client() client = Client()
self.assertIsNotNone(client.status()) self.assertIsNotNone(client.status())

View File

@ -3,5 +3,6 @@
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
pbr>=2.0 # Apache-2.0 pbr>=2.0 # Apache-2.0
urllib3>=1.8.3 # MIT
requests>=2.10.0,!=2.12.2,!=2.13.0 # Apache-2.0 requests>=2.10.0,!=2.12.2,!=2.13.0 # Apache-2.0
six>=1.9.0 # MIT six>=1.9.0 # MIT

10
tox.ini
View File

@ -9,7 +9,9 @@ install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstac
setenv = setenv =
VIRTUAL_ENV={envdir} VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning PYTHONWARNINGS=default::DeprecationWarning
deps = -r{toxinidir}/test-requirements.txt deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = python setup.py test --slowest --testr-args='{posargs}' commands = python setup.py test --slowest --testr-args='{posargs}'
[testenv:pep8] [testenv:pep8]
@ -26,6 +28,12 @@ commands =
[testenv:docs] [testenv:docs]
commands = python setup.py build_sphinx commands = python setup.py build_sphinx
[testenv:py27-etcd]
commands = {toxinidir}/setup-etcd-env.sh pifpaf -g TOOZ_TEST run etcd -- python setup.py test --slowest --testr-args='{posargs}'
[testenv:py35-etcd]
commands = {toxinidir}/setup-etcd-env.sh pifpaf -g TOOZ_TEST run etcd -- python setup.py test --slowest --testr-args='{posargs}'
[testenv:examples] [testenv:examples]
commands = {toxinidir}/setup-etcd-env.sh pifpaf -g TOOZ_TEST run etcd -- python {toxinidir}/etcd3gw/examples/etcd.py commands = {toxinidir}/setup-etcd-env.sh pifpaf -g TOOZ_TEST run etcd -- python {toxinidir}/etcd3gw/examples/etcd.py