Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combined PR to fix CI #434

Merged
merged 6 commits into from
Feb 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion ci/rtd-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# RTD is currently installing 1.5.3, which has a bug in :lineno-match:
sphinx >= 1.6.1
# 1.7.0 hits https://github.com/sphinx-doc/sphinx/issues/4609
sphinx == 1.6.7
sphinx_rtd_theme
sphinxcontrib-trio
11 changes: 7 additions & 4 deletions ci/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ if [ "$USE_PYPY_NIGHTLY" = "1" ]; then
# something like "pypy-c-jit-89963-748aa3022295-linux64"
PYPY_DIR=$(echo pypy-c-jit-*)
PYTHON_EXE=$PYPY_DIR/bin/pypy3
($PYTHON_EXE -m ensurepip \
&& $PYTHON_EXE -m pip install virtualenv \
&& $PYTHON_EXE -m virtualenv testenv) \
|| (echo "pypy nightly is broken; skipping tests"; exit 0)

if ! ($PYTHON_EXE -m ensurepip \
&& $PYTHON_EXE -m pip install virtualenv \
&& $PYTHON_EXE -m virtualenv testenv); then
echo "pypy nightly is broken; skipping tests"
exit 0
fi
source testenv/bin/activate
fi

Expand Down
4 changes: 2 additions & 2 deletions trio/_core/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ def _return_value_looks_like_wrong_library(value):
.format(async_fn=async_fn)
) from None

# Give good error for: nursery.start_soon(asyncio.sleep(1))
# Give good error for: nursery.start_soon(future)
if _return_value_looks_like_wrong_library(async_fn):
raise TypeError(
"trio was expecting an async function, but instead it got "
Expand All @@ -785,7 +785,7 @@ def _return_value_looks_like_wrong_library(value):
# function. So we have to just call it and then check whether the
# result is a coroutine object.
if not inspect.iscoroutine(coro):
# Give good error for: nursery.start_soon(asyncio.sleep, 1)
# Give good error for: nursery.start_soon(func_returning_future)
if _return_value_looks_like_wrong_library(coro):
raise TypeError(
"start_soon got unexpected {!r} – are you trying to use a "
Expand Down
2 changes: 1 addition & 1 deletion trio/_core/tests/test_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_Result():
assert e.error is exc
with pytest.raises(RuntimeError):
e.unwrap()
assert repr(e) == "Error(RuntimeError('oops',))"
assert repr(e) == "Error({!r})".format(exc)

with pytest.raises(TypeError):
Error("hello")
Expand Down
8 changes: 6 additions & 2 deletions trio/_core/tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1553,16 +1553,20 @@ async def f(): # pragma: no cover

import asyncio

@asyncio.coroutine
def generator_based_coro(): # pragma: no cover
yield from asyncio.sleep(1)

with pytest.raises(TypeError) as excinfo:
bad_call(asyncio.sleep(1))
bad_call(generator_based_coro())
assert "asyncio" in str(excinfo.value)

with pytest.raises(TypeError) as excinfo:
bad_call(asyncio.Future())
assert "asyncio" in str(excinfo.value)

with pytest.raises(TypeError) as excinfo:
bad_call(asyncio.sleep, 1)
bad_call(generator_based_coro)
assert "asyncio" in str(excinfo.value)

with pytest.raises(TypeError) as excinfo:
Expand Down