diff --git a/ci/rtd-requirements.txt b/ci/rtd-requirements.txt index 67898ba6f5..4f07be4ab8 100644 --- a/ci/rtd-requirements.txt +++ b/ci/rtd-requirements.txt @@ -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 diff --git a/ci/travis.sh b/ci/travis.sh index b87cb32e96..7481deae82 100755 --- a/ci/travis.sh +++ b/ci/travis.sh @@ -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 diff --git a/trio/_core/_run.py b/trio/_core/_run.py index ca1f0a9440..1f52b02d15 100644 --- a/trio/_core/_run.py +++ b/trio/_core/_run.py @@ -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 " @@ -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 " diff --git a/trio/_core/tests/test_result.py b/trio/_core/tests/test_result.py index 4924178437..9d6cdd8f38 100644 --- a/trio/_core/tests/test_result.py +++ b/trio/_core/tests/test_result.py @@ -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") diff --git a/trio/_core/tests/test_run.py b/trio/_core/tests/test_run.py index ce05f500c1..02e4d198ae 100644 --- a/trio/_core/tests/test_run.py +++ b/trio/_core/tests/test_run.py @@ -1553,8 +1553,12 @@ 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: @@ -1562,7 +1566,7 @@ async def f(): # pragma: no cover 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: