Skip to content

Commit

Permalink
Mock the right thing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Mar 27, 2018
1 parent 4f08b5c commit f688143
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ZEO/asyncio/client.py
Expand Up @@ -122,7 +122,7 @@ def connect(self):
cr = self.loop.create_unix_connection(
self.protocol_factory, self.addr, ssl=self.ssl)

self._connecting = cr = asyncio.async(cr, loop=self.loop)
self._connecting = cr = asyncio.ensure_future(cr, loop=self.loop)

@cr.add_done_callback
def done_connecting(future):
Expand Down
2 changes: 1 addition & 1 deletion src/ZEO/asyncio/mtacceptor.py
Expand Up @@ -191,7 +191,7 @@ def make_ssl_transport(*a, **kw):
server_hostname=''
)

asyncio.async(cr, loop=loop)
asyncio.ensure_future(cr, loop=loop)
loop.run_forever()
loop.close()

Expand Down
2 changes: 1 addition & 1 deletion src/ZEO/tests/testZEO.py
Expand Up @@ -1203,7 +1203,7 @@ def runzeo_without_configfile():
... ''' % sys.path)
>>> import subprocess, re
>>> print(re.sub(b'\d\d+|[:]', b'', subprocess.Popen(
>>> print(re.sub(br'\d\d+|[:]', b'', subprocess.Popen(
... [sys.executable, 'runzeo', '-a:0', '-ft', '--test'],
... stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
... ).stdout.read()).decode('ascii'))
Expand Down
6 changes: 3 additions & 3 deletions src/ZEO/tests/testssl.py
Expand Up @@ -118,7 +118,7 @@ def test_ssl_pw(self):
stop()

@unittest.skipIf(forker.ZEO4_SERVER, "ZEO4 servers don't support SSL")
@mock.patch(('asyncio' if PY3 else 'trollius') + '.async')
@mock.patch(('asyncio' if PY3 else 'trollius') + '.ensure_future')
@mock.patch(('asyncio' if PY3 else 'trollius') + '.set_event_loop')
@mock.patch(('asyncio' if PY3 else 'trollius') + '.new_event_loop')
@mock.patch('ZEO.asyncio.client.new_event_loop')
Expand Down Expand Up @@ -218,7 +218,7 @@ def test_ssl_mockiavellian_client_auth_dir(
capath=here,
check_hostname=True,
)
context.load_default_certs.assertTruenot_called()
context.load_default_certs.assert_not_called()

@mock.patch('ssl.create_default_context')
@mock.patch('ZEO.ClientStorage.ClientStorage')
Expand All @@ -235,7 +235,7 @@ def test_ssl_mockiavellian_client_auth_file(
cafile=server_cert,
check_hostname=True,
)
context.load_default_certs.assertTruenot_called()
context.load_default_certs.assert_not_called()

@mock.patch('ssl.create_default_context')
@mock.patch('ZEO.ClientStorage.ClientStorage')
Expand Down

0 comments on commit f688143

Please sign in to comment.