Skip to content
This repository was archived by the owner on Apr 15, 2024. It is now read-only.

Commit a10cd7b

Browse files
author
Shaheed Haque
committed
Get tests running at least for Python3.x.
1 parent 5194a57 commit a10cd7b

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def run_tests(self):
5353
url='https://github.com/cablehead/python-consul',
5454
license='MIT',
5555
description=description,
56-
long_description=open('README.rst').read() + '\n\n' +
56+
long_description=open('README.rst').read() + '\n\n' + # noqa: W504
5757
open('CHANGELOG.rst').read(),
5858
py_modules=py_modules,
5959
install_requires=requirements,

tests/test_aio.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111

1212
Check = consul.Check
13+
if hasattr(asyncio, 'ensure_future'):
14+
ensure_future = asyncio.ensure_future
15+
else: # Deprecated since Python 3.4.4
16+
ensure_future = getattr(asyncio, "async")
1317

1418

1519
@pytest.fixture
@@ -74,7 +78,7 @@ def test_kv_missing(self, loop, consul_port):
7478

7579
@asyncio.coroutine
7680
def main():
77-
fut = asyncio.async(put(), loop=loop)
81+
fut = ensure_future(put(), loop=loop)
7882
yield from c.kv.put('index', 'bump')
7983
index, data = yield from c.kv.get('foo')
8084
assert data is None
@@ -133,7 +137,7 @@ def test_kv_subscribe(self, loop, consul_port):
133137

134138
@asyncio.coroutine
135139
def get():
136-
fut = asyncio.async(put(), loop=loop)
140+
fut = ensure_future(put(), loop=loop)
137141
index, data = yield from c.kv.get('foo')
138142
assert data is None
139143
index, data = yield from c.kv.get('foo', index=index)
@@ -197,7 +201,7 @@ def test_catalog(self, loop, consul_port):
197201

198202
@asyncio.coroutine
199203
def nodes():
200-
fut = asyncio.async(register(), loop=loop)
204+
fut = ensure_future(register(), loop=loop)
201205
index, nodes = yield from c.catalog.nodes()
202206
assert len(nodes) == 1
203207
current = nodes[0]
@@ -228,7 +232,7 @@ def test_session(self, loop, consul_port):
228232

229233
@asyncio.coroutine
230234
def monitor():
231-
fut = asyncio.async(register(), loop=loop)
235+
fut = ensure_future(register(), loop=loop)
232236
index, services = yield from c.session.list()
233237
assert services == []
234238
yield from asyncio.sleep(20/1000.0, loop=loop)

tox.ini

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = flake8, py26, py27, pypy, py35, py36
2+
envlist = flake8, py26, py27, pypy, py35, py36, py37
33

44
[flake8]
55
ignore = F811,E226
@@ -57,6 +57,22 @@ commands =
5757
py.test --reruns=3 {posargs:consul tests}
5858
flake8 --exclude=".tox/*,xx/*,__*,docs/*"
5959

60+
[testenv:py37]
61+
deps =
62+
pytest
63+
pytest-rerunfailures
64+
pytest-twisted
65+
twisted
66+
treq
67+
pyOpenSSL
68+
tornado
69+
aiohttp
70+
flake8
71+
requests
72+
commands =
73+
py.test --reruns=3 {posargs:consul tests}
74+
flake8 --exclude=".tox/*,xx/*,__*,docs/*"
75+
6076
[testenv:flake8]
6177
deps = flake8
6278
commands = flake8

0 commit comments

Comments
 (0)