Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #491 from uber/py37
Browse files Browse the repository at this point in the history
Updating to py37 compatibility
  • Loading branch information
westover committed Oct 22, 2019
2 parents 10b5fa3 + 2de6236 commit 613faa9
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 32 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Expand Up @@ -9,7 +9,11 @@ services:
# @see https://www.dominicrodger.com/tox-and-travis.html
#
language: python
python: 2.7
python:
- "2.7"
- "3.4"
- "3.6"
- "3.7"
env:
global:
- DOCKER_COMPOSE_VERSION=1.8.0
Expand All @@ -19,7 +23,6 @@ env:
# DOCKER_USER
- secure: zTYWdKexitzOizfPCxZ/O7LwSy0B8P0iwwzHueXnVC/Z/8tR0lPorqfy8pY1Ctc5yRuFMDMrmk+HHcb1ox+QoBcWrSZwmR5GAe5Uf7Hy/qzngqGb4qg6cAtUEIzPQN8PGNI0sun50WiiZV4/M05pCL5IKYgilsfKE8ecBXmEu9iMyH7f1U9h7KVQoxe1VaOZHhSz549xUnug5H4Xq+ou62MxDhkLHMkBf9BsFyHWNbw06YIbbArho8V8Hmz28y3ejsjtRzPGS+BHhsX9lCek7MI9NNM5MWar1ZRhmU6qShmoRl9H0eG3bgs5/8iUQWLQQeEgEr8DgFcVYfHAavJqBenyir7Qok+9PBuP5lc/SvNgLmG5pHsUX+Py0luJzyTqDoFn+2TV+zfFYVdWpMnXrYKyE+NGL7QSvhfPby4EzAMA1KeS3QkK9F+1LPU7U6+Q92+cQ69GZGaVG8tAdy/XpJw+q+PSjflNxRVXkJp1mqGkyU07h5bGwCj6GE1FvE160QiFVg0Tz7rNGLRmYPRLAxk8gCc6E+rMljF+/LoLWdYohFfRoPe2K0l8rsi/wqsX4xLp22oWr29woKF40lyIokTLcv1sDo8xwMSeNA0ledUTREGb33fWoWoB/ZJDAnKZMY1SWUEi+owGtW3aRJlN5auOoPoe7LxMf3HlzyojEaQ=
matrix:
- TOX_ENV=py34
- TOX_ENV=crossdock
- TOX_ENV=cover
- TOX_ENV=flake8
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Expand Up @@ -4,7 +4,8 @@ Changes by Version
2.0.2 (unreleased)
------------------

- Nothing changed yet.
- Support py37
- Remove inject feature of cassette


2.0.1 (2019-10-01)
Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
@@ -1,5 +1,5 @@
# Testing and coverage
pytest
pytest<5
pytest-cov
pytest-timeout
pytest-tornado
Expand Down
2 changes: 2 additions & 0 deletions tchannel/testing/vcr/config.py
Expand Up @@ -38,6 +38,8 @@ def __init__(self, path, record_mode, inject, matchers):
self.record_mode = record_mode
self.inject = inject
self.matchers = matchers
if self.inject:
raise DeprecationWarning('Use of inject is no longer supported')

self._exit_stack = contextlib2.ExitStack()

Expand Down
4 changes: 2 additions & 2 deletions tchannel/tornado/connection.py
Expand Up @@ -193,7 +193,7 @@ def _on_close(self):
if self._close_cb:
self._close_cb()

def await(self):
def _await(self):
"""Get the next call to this TChannel."""
if self._handshake_performed:
return self._messages.get()
Expand Down Expand Up @@ -514,7 +514,7 @@ def serve(self, handler):
assert handler, "handler is required"

while not self.closed:
message = yield self.await()
message = yield self._await()

try:
handler(message, self)
Expand Down
18 changes: 0 additions & 18 deletions tests/testing/vcr/integration/test_vcr.py
Expand Up @@ -261,24 +261,6 @@ def f():
assert body == b'world'


@pytest.mark.gen_test
def test_use_cassette_as_decorator_with_inject(tmpdir, mock_server, call):
path = tmpdir.join('data.yaml')
mock_server.expect_call('hello').and_raise(Exception('great sadness'))

@gen.coroutine
@vcr.use_cassette(str(path), inject=True)
def f(cassette):
with pytest.raises(UnexpectedError):
yield call('hello', 'world', service='hello_service')

assert len(cassette.data) == 0
assert cassette.play_count == 0

yield f()
yield f()


@pytest.mark.gen_test
def test_use_cassette_with_matchers(tmpdir, mock_server, call, get_body):
path = tmpdir.join('data.yaml')
Expand Down
12 changes: 6 additions & 6 deletions tests/tornado/test_connection.py
Expand Up @@ -79,12 +79,12 @@ def test_pings(tornado_pair):
server, client = tornado_pair
client.ping()

ping = yield server.await()
ping = yield server._await()
assert ping.message_type == messages.Types.PING_REQ

server.pong()

pong = yield client.await()
pong = yield client._await()
assert pong.message_type == messages.Types.PING_RES


Expand Down Expand Up @@ -161,7 +161,7 @@ def hello(request):
def test_stream_closed_error_on_read(tornado_pair):
# Test that we don't log an error for StreamClosedErrors while reading.
server, client = tornado_pair
future = server.await()
future = server._await()
client.close()

with mock.patch.object(connection, 'log') as mock_log: # :(
Expand All @@ -178,7 +178,7 @@ def test_other_error_on_read(tornado_pair):
# reading.
server, client = tornado_pair

future = server.await()
future = server._await()
yield client.connection.write(b'\x00\x02\x00\x00') # bad payload

with mock.patch.object(connection, 'log') as mock_log: # :(
Expand Down Expand Up @@ -406,7 +406,7 @@ def test_loop_failure(tornado_pair):
headers={'cn': 'client'},
))

call_req = yield server.await()
call_req = yield server._await()
assert call_req.message_type == messages.Types.CALL_REQ

response = Response(id=id)
Expand Down Expand Up @@ -453,7 +453,7 @@ def test_timeout_not_pending(tornado_pair):
))
assert id in client._outbound_pending_call

call_req = yield server.await()
call_req = yield server._await()
assert call_req.message_type == messages.Types.CALL_REQ

yield gen.sleep(0.1) # make the request time out
Expand Down
7 changes: 5 additions & 2 deletions tox.ini
@@ -1,16 +1,19 @@
[tox]
envlist = py34,cover,flake8,docs
envlist = py34,py35,py36,py37,cover,flake8,docs


[testenv]
deps =
-rrequirements-test.txt
whitelist_externals = /usr/bin/make
commands =
py.test --cov-report=term-missing --cov tchannel --cov-report=xml -v {posargs}
pytest --cov-report=term-missing --cov tchannel --cov-report=xml -v {posargs}
basepython =
py27: python2.7
py34: python3.4
py35: python3.5
py36: python3.6
py37: python3.7
pypy: pypy


Expand Down

0 comments on commit 613faa9

Please sign in to comment.