Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ff21f65
Support for PY37 without contexvars
pfreixes Apr 10, 2018
efc3a9e
Testing with Ubuntu Xenial for PY37 step, comes with 3.7.0b1+
pfreixes Apr 10, 2018
1f01d3f
Run Python 3.7 Travis step using docker
pfreixes Apr 15, 2018
0d1dc9c
Dont relay on Travis PY37 environment
pfreixes Apr 15, 2018
2b3b1c7
Fixes an issue testing the environment in the travis file
pfreixes Apr 15, 2018
9ea9e29
Disable pip upgrade at Travis CI
pfreixes Apr 16, 2018
6714d99
Added back the explicit del asyncio and other minor stuff
pfreixes Apr 17, 2018
8421107
Temporary commit to get more info about Python env and Pip env
pfreixes Apr 17, 2018
36407ac
Test again the 3.7 Travis Python image
pfreixes Apr 17, 2018
9dfd99d
Get rid of none functional Travis Python 3.7 configuration
pfreixes Apr 17, 2018
5cb302c
Do not upgrade pip for Travis CI
pfreixes Apr 17, 2018
f0375bc
Travis CI Pins PIP to 9.X for OSX enviornment
pfreixes Apr 17, 2018
3a3e4cc
Fixed invalid pined expresion
pfreixes Apr 17, 2018
d1bdc50
Test py37 recipe using an external PPA
pfreixes Apr 19, 2018
4c1d9cf
Test with pyenv
pfreixes Apr 19, 2018
b163831
Test with pyenv refatorized
pfreixes Apr 19, 2018
5850466
Explicit Python 3.7 to 3.7-dev
pfreixes Apr 19, 2018
04b272f
Force use PYENV PYTHON_VERSION when PYENV is used rather than the sys…
pfreixes Apr 19, 2018
51776f1
Trigger Travis
pfreixes Apr 19, 2018
1705d78
Force last beta release
pfreixes Apr 20, 2018
2e358c9
Removed no longer used Docker service
pfreixes Apr 20, 2018
d9eee1a
Merge branch 'master' into support_PY37
pfreixes May 4, 2018
ed32c95
debug
pfreixes May 4, 2018
b9efa8d
Debug failure test in CI
pfreixes May 4, 2018
8e6184c
Test with trusty
pfreixes May 4, 2018
8480b46
Get network interfaces in Travis
pfreixes May 4, 2018
8fe70b9
Python 3.7.0b4 back for xenial wihout pyenv?
pfreixes May 4, 2018
8646ff4
Trigger CI
pfreixes May 4, 2018
3bd621f
Trigger CI 2
pfreixes May 4, 2018
0f36879
Run only problematic test
pfreixes May 5, 2018
5bdb238
Test without debug asyncio
pfreixes May 6, 2018
09cffad
Test 3.6 against Xenial
pfreixes May 6, 2018
7638a59
Test all Travis matrix
pfreixes May 6, 2018
8c3b28a
Fix use of PIPENV for Mac OSX
pfreixes May 6, 2018
46480da
Test with only 3.5 and 3.7-dev
pfreixes May 6, 2018
5338ae6
Only 3.7-dev
pfreixes May 6, 2018
b3a9de1
Test with PYENV=true PYTHON_VERSION=3.7.0b3
pfreixes May 6, 2018
7d7ac60
Test with PYENV=true PYTHON_VERSION=3.7.0b3
pfreixes May 6, 2018
f7fc3e1
Test with PYENV=true PYTHON_VERSION=3.7.0b4
pfreixes May 20, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/travis-build-wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [[ "${TRAVIS_BRANCH}" != "releases" || "${BUILD}" != *wheels* ]]; then
fi


if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
if [ "${PYENV}" == "true" ]; then
PYENV_ROOT="$HOME/.pyenv"
PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
Expand Down
31 changes: 27 additions & 4 deletions .ci/travis-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@

set -e -x

if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
brew update >/dev/null
brew upgrade pyenv
if [ "${PYENV}" == "true" ]; then

if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
brew update >/dev/null
brew upgrade pyenv
else
git clone --depth 1 https://github.com/yyuu/pyenv.git ~/.pyenv
PYENV_ROOT="$HOME/.pyenv"
PATH="$PYENV_ROOT/bin:$PATH"
fi

eval "$(pyenv init -)"

if ! (pyenv versions | grep "${PYTHON_VERSION}$"); then
Expand All @@ -13,11 +21,26 @@ if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
pyenv global ${PYTHON_VERSION}
pyenv rehash

python --version
fi

if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
brew update

brew install gnu-sed --with-default-names
brew outdated libtool || brew upgrade libtool
brew outdated autoconf || brew upgrade autoconf --with-default-names
brew outdated automake || brew upgrade automake --with-default-names

# Pined to 9.0.X till following issues are addressed
# https://github.com/pypa/pip/issues/5240
# https://github.com/pyenv/pyenv/issues/1141
pip install --upgrade pip~=9.0.0
else
pip install --upgrade pip
fi

pip install --upgrade setuptools pip wheel

pip install --upgrade wheel
pip install --upgrade setuptools
pip install -r .ci/requirements.txt
5 changes: 4 additions & 1 deletion .ci/travis-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ if [[ "${BUILD}" != *tests* ]]; then
exit 0
fi

if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
if [ "${PYENV}" == "true" ]; then
PYENV_ROOT="$HOME/.pyenv"
PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
pyenv global ${PYTHON_VERSION}
fi

python --version

make distclean && make && make test
make distclean && make debug && make test
36 changes: 3 additions & 33 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,42 +28,12 @@ matrix:
fast_finish: true

include:
- os: osx
osx_image: xcode7.3
# Travis macOS env does not support Python yet,
# so we have to set things up manually in install.sh.
env: BUILD=tests,wheels PYTHON_VERSION=3.5.5
branches: {only: [releases]}

- os: osx
osx_image: xcode7.3
# Travis macOS env does not support Python yet,
# so we have to set things up manually in install.sh.
env: BUILD=tests,wheels PYTHON_VERSION=3.6.5
branches: {only: [releases]}

- os: linux
dist: trusty
dist: xenial
sudo: false
language: python
python: "3.5"
env: BUILD=tests

- os: linux
dist: trusty
sudo: false
language: python
python: "3.6"
env: BUILD=tests

- os: linux
dist: trusty
branches: {only: [releases]}
sudo: required
language: python
python: "3.5"
services: [docker]
env: BUILD=tests,wheels,release
python: "3.7-dev"
env: BUILD=tests PYENV=true PYTHON_VERSION=3.7.0b4

cache:
pip
Expand Down
20 changes: 10 additions & 10 deletions tests/test_pipes.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio
import io
import os
import socket

from asyncio import test_utils
from uvloop import _testbase as tb


Expand Down Expand Up @@ -81,11 +81,11 @@ def connect():
self.loop.run_until_complete(connect())

os.write(wpipe, b'1')
test_utils.run_until(self.loop, lambda: proto.nbytes >= 1)
tb.run_until(self.loop, lambda: proto.nbytes >= 1)
self.assertEqual(1, proto.nbytes)

os.write(wpipe, b'2345')
test_utils.run_until(self.loop, lambda: proto.nbytes >= 5)
tb.run_until(self.loop, lambda: proto.nbytes >= 5)
self.assertEqual(['INITIAL', 'CONNECTED'], proto.state)
self.assertEqual(5, proto.nbytes)

Expand Down Expand Up @@ -114,11 +114,11 @@ def connect():
self.loop.run_until_complete(connect())

os.write(slave, b'1')
test_utils.run_until(self.loop, lambda: proto.nbytes)
tb.run_until(self.loop, lambda: proto.nbytes)
self.assertEqual(1, proto.nbytes)

os.write(slave, b'2345')
test_utils.run_until(self.loop, lambda: proto.nbytes >= 5)
tb.run_until(self.loop, lambda: proto.nbytes >= 5)
self.assertEqual(['INITIAL', 'CONNECTED'], proto.state)
self.assertEqual(5, proto.nbytes)

Expand Down Expand Up @@ -157,11 +157,11 @@ def reader(data):
data += chunk
return len(data)

test_utils.run_until(self.loop, lambda: reader(data) >= 1)
tb.run_until(self.loop, lambda: reader(data) >= 1)
self.assertEqual(b'1', data)

transport.write(b'2345')
test_utils.run_until(self.loop, lambda: reader(data) >= 5)
tb.run_until(self.loop, lambda: reader(data) >= 5)
self.assertEqual(b'12345', data)
self.assertEqual('CONNECTED', proto.state)

Expand All @@ -176,7 +176,7 @@ def reader(data):
self.assertEqual('CLOSED', proto.state)

def test_write_pipe_disconnect_on_close(self):
rsock, wsock = test_utils.socketpair()
rsock, wsock = socket.socketpair()
rsock.setblocking(False)

pipeobj = io.open(wsock.detach(), 'wb', 1024)
Expand Down Expand Up @@ -222,12 +222,12 @@ def reader(data):
data += chunk
return len(data)

test_utils.run_until(self.loop, lambda: reader(data) >= 1,
tb.run_until(self.loop, lambda: reader(data) >= 1,
timeout=10)
self.assertEqual(b'1', data)

transport.write(b'2345')
test_utils.run_until(self.loop, lambda: reader(data) >= 5,
tb.run_until(self.loop, lambda: reader(data) >= 5,
timeout=10)
self.assertEqual(b'12345', data)
self.assertEqual('CONNECTED', proto.state)
Expand Down
7 changes: 3 additions & 4 deletions tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import time
import unittest

from asyncio import test_utils
from uvloop import _testbase as tb


Expand Down Expand Up @@ -504,7 +503,7 @@ def cancel_make_transport():

# ignore the log:
# "Exception during subprocess creation, kill the subprocess"
with test_utils.disable_logger():
with tb.disable_logger():
self.loop.run_until_complete(cancel_make_transport())

def test_cancel_post_init(self):
Expand All @@ -522,9 +521,9 @@ def cancel_make_transport():

# ignore the log:
# "Exception during subprocess creation, kill the subprocess"
with test_utils.disable_logger():
with tb.disable_logger():
self.loop.run_until_complete(cancel_make_transport())
test_utils.run_briefly(self.loop)
tb.run_briefly(self.loop)


class Test_UV_Process(_TestProcess, tb.UVTestCase):
Expand Down
34 changes: 17 additions & 17 deletions tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import asyncio

from asyncio import test_utils
from uvloop import _testbase as tb


Expand Down Expand Up @@ -44,7 +43,7 @@ def notmuch():
'_TestTasks.test_task_repr.<locals>.notmuch')
self.assertEqual(notmuch.__module__, __name__)

filename, lineno = test_utils.get_function_source(notmuch)
filename, lineno = tb.get_function_source(notmuch)
src = "%s:%s" % (filename, lineno)

# test coroutine object
Expand Down Expand Up @@ -109,7 +108,7 @@ def task():
return 12

t = self.create_task(task())
test_utils.run_briefly(self.loop) # start coro
tb.run_briefly(self.loop) # start coro
t.cancel()
self.assertRaises(
asyncio.CancelledError, self.loop.run_until_complete, t)
Expand All @@ -126,7 +125,7 @@ def task():
return 12

t = self.create_task(task())
test_utils.run_briefly(self.loop) # start task
tb.run_briefly(self.loop) # start task
f.cancel()
with self.assertRaises(asyncio.CancelledError):
self.loop.run_until_complete(t)
Expand All @@ -143,7 +142,7 @@ def task():

t = self.create_task(task())
self.assertEqual(asyncio.Task.all_tasks(loop=self.loop), {t})
test_utils.run_briefly(self.loop)
tb.run_briefly(self.loop)

f.cancel()
t.cancel()
Expand All @@ -168,10 +167,10 @@ def task():
return 42

t = self.create_task(task())
test_utils.run_briefly(self.loop)
tb.run_briefly(self.loop)
self.assertIs(t._fut_waiter, fut1) # White-box test.
fut1.set_result(None)
test_utils.run_briefly(self.loop)
tb.run_briefly(self.loop)
self.assertIs(t._fut_waiter, fut2) # White-box test.
t.cancel()
self.assertTrue(fut2.cancelled())
Expand All @@ -195,14 +194,14 @@ def task():
return res

t = self.create_task(task())
test_utils.run_briefly(self.loop)
tb.run_briefly(self.loop)
self.assertIs(t._fut_waiter, fut1) # White-box test.
fut1.set_result(None)
test_utils.run_briefly(self.loop)
tb.run_briefly(self.loop)
self.assertIs(t._fut_waiter, fut2) # White-box test.
t.cancel()
self.assertTrue(fut2.cancelled())
test_utils.run_briefly(self.loop)
tb.run_briefly(self.loop)
self.assertIs(t._fut_waiter, fut3) # White-box test.
fut3.set_result(42)
res = self.loop.run_until_complete(t)
Expand Down Expand Up @@ -232,7 +231,8 @@ def notmutch():
raise BaseException()

task = self.create_task(notmutch())
self.assertRaises(BaseException, task._step)
with self.assertRaises(BaseException):
tb.run_briefly(self.loop)

self.assertTrue(task.done())
self.assertIsInstance(task.exception(), BaseException)
Expand All @@ -245,7 +245,7 @@ def __init__(self, *args, **kwds):
self.cb_added = False
super().__init__(*args, **kwds)

def add_done_callback(self, fn):
def add_done_callback(self, fn, context=None):
self.cb_added = True
super().add_done_callback(fn)

Expand All @@ -258,12 +258,12 @@ def wait_for_future():
result = yield from fut

t = self.create_task(wait_for_future())
test_utils.run_briefly(self.loop)
tb.run_briefly(self.loop)
self.assertTrue(fut.cb_added)

res = object()
fut.set_result(res)
test_utils.run_briefly(self.loop)
tb.run_briefly(self.loop)
self.assertIs(res, result)
self.assertTrue(t.done())
self.assertIsNone(t.result())
Expand Down Expand Up @@ -356,7 +356,7 @@ def outer():
proof += 10

f = asyncio.ensure_future(outer(), loop=self.loop)
test_utils.run_briefly(self.loop)
tb.run_briefly(self.loop)
f.cancel()
self.loop.run_until_complete(f)
self.assertEqual(proof, 101)
Expand All @@ -381,12 +381,12 @@ def outer():
proof += 100

f = asyncio.ensure_future(outer(), loop=self.loop)
test_utils.run_briefly(self.loop)
tb.run_briefly(self.loop)
f.cancel()
self.assertRaises(
asyncio.CancelledError, self.loop.run_until_complete, f)
waiter.set_result(None)
test_utils.run_briefly(self.loop)
tb.run_briefly(self.loop)
self.assertEqual(proof, 1)


Expand Down
5 changes: 2 additions & 3 deletions tests/test_udp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import unittest
import sys

from asyncio import test_utils
from uvloop import _testbase as tb


Expand Down Expand Up @@ -77,9 +76,9 @@ def datagram_received(self, data, addr):
self.assertIs(client.transport, transport)

transport.sendto(b'xxx')
test_utils.run_until(self.loop, lambda: server.nbytes)
tb.run_until(self.loop, lambda: server.nbytes)
self.assertEqual(3, server.nbytes)
test_utils.run_until(self.loop, lambda: client.nbytes)
tb.run_until(self.loop, lambda: client.nbytes)

# received
self.assertEqual(8, client.nbytes)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_unix.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import tempfile
import time
import unittest
import sys

from uvloop import _testbase as tb

Expand Down Expand Up @@ -362,6 +363,7 @@ async def client():
self.assertIn(excs[0].__class__,
(BrokenPipeError, ConnectionResetError))

@unittest.skipUnless(sys.version_info < (3, 7), 'Python version must be < 3.7')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have some light about why this testing is failing with 3.7 please tell me.

def test_transport_unclosed_warning(self):
async def test(sock):
return await self.loop.create_unix_connection(
Expand Down
Loading