Commit f7a7c6a7 authored by Jim Fulton's avatar Jim Fulton Committed by GitHub

Merge pull request #70 from zopefoundation/uvloop

Uvloop
parents 772221b8 417b4b61
...@@ -18,14 +18,14 @@ matrix: ...@@ -18,14 +18,14 @@ matrix:
python: 2.7 python: 2.7
env: ZEO4_SERVER=1 env: ZEO4_SERVER=1
- os: linux - os: linux
python: 3.4 python: 3.5
env: ZEO4_SERVER=1 env: ZEO4_SERVER=1
- os: linux - os: linux
python: 3.5 python: 3.5
env: ZEO4_SERVER=1 env: BUILOUT_OPTIONS=extra=,uvloop
install: install:
- pip install zc.buildout - pip install zc.buildout
- buildout - buildout $BUILOUT_OPTIONS
cache: cache:
directories: directories:
- eggs - eggs
......
...@@ -4,6 +4,7 @@ parts = ...@@ -4,6 +4,7 @@ parts =
test test
scripts scripts
versions = versions versions = versions
extra =
[versions] [versions]
...@@ -11,7 +12,7 @@ versions = versions ...@@ -11,7 +12,7 @@ versions = versions
[test] [test]
recipe = zc.recipe.testrunner recipe = zc.recipe.testrunner
eggs = eggs =
ZEO [test] ZEO [test${buildout:extra}]
initialization = initialization =
import os, tempfile import os, tempfile
try: os.mkdir('tmp') try: os.mkdir('tmp')
...@@ -21,6 +22,5 @@ defaults = ['--all'] ...@@ -21,6 +22,5 @@ defaults = ['--all']
[scripts] [scripts]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = eggs = ${test:eggs}
ZEO [test]
interpreter = py interpreter = py
...@@ -128,7 +128,7 @@ setup(name="ZEO", ...@@ -128,7 +128,7 @@ setup(name="ZEO",
classifiers = classifiers, classifiers = classifiers,
test_suite="__main__.alltests", # to support "setup.py test" test_suite="__main__.alltests", # to support "setup.py test"
tests_require = tests_require, tests_require = tests_require,
extras_require = dict(test=tests_require), extras_require = dict(test=tests_require, uvloop=['uvloop']),
install_requires = install_requires, install_requires = install_requires,
zip_safe = False, zip_safe = False,
entry_points = """ entry_points = """
......
...@@ -2,8 +2,13 @@ from .._compat import PY3 ...@@ -2,8 +2,13 @@ from .._compat import PY3
if PY3: if PY3:
import asyncio import asyncio
try:
from uvloop import new_event_loop
except ImportError:
from asyncio import new_event_loop
else: else:
import trollius as asyncio import trollius as asyncio
from trollius import new_event_loop
from ZEO.Exceptions import ClientDisconnected, ServerException from ZEO.Exceptions import ClientDisconnected, ServerException
import concurrent.futures import concurrent.futures
...@@ -836,7 +841,7 @@ class ClientThread(ClientRunner): ...@@ -836,7 +841,7 @@ class ClientThread(ClientRunner):
def run(self): def run(self):
loop = None loop = None
try: try:
loop = asyncio.new_event_loop() loop = new_event_loop()
self.setup_delegation(loop) self.setup_delegation(loop)
self.started.set() self.started.set()
loop.run_forever() loop.run_forever()
......
...@@ -120,6 +120,7 @@ class SSLConfigTest(ZEOConfigTestBase): ...@@ -120,6 +120,7 @@ class SSLConfigTest(ZEOConfigTestBase):
@mock.patch(('asyncio' if PY3 else 'trollius') + '.async') @mock.patch(('asyncio' if PY3 else 'trollius') + '.async')
@mock.patch(('asyncio' if PY3 else 'trollius') + '.set_event_loop') @mock.patch(('asyncio' if PY3 else 'trollius') + '.set_event_loop')
@mock.patch(('asyncio' if PY3 else 'trollius') + '.new_event_loop') @mock.patch(('asyncio' if PY3 else 'trollius') + '.new_event_loop')
@mock.patch('ZEO.asyncio.client.new_event_loop')
class SSLConfigTestMockiavellian(ZEOConfigTestBase): class SSLConfigTestMockiavellian(ZEOConfigTestBase):
@mock.patch('ssl.create_default_context') @mock.patch('ssl.create_default_context')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment