Skip to content

Commit 520768e

Browse files
authored
Merge branch 'master' into release-0.12.0
2 parents 0b7f978 + b93c320 commit 520768e

File tree

7 files changed

+28
-11
lines changed

7 files changed

+28
-11
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ jobs:
4848
- python: '3.8'
4949
check_formatting: '1'
5050
extra_name: ', check formatting'
51-
- python: '3.8'
52-
check_docs: '1'
53-
extra_name: ', check docs'
5451
# pypy3.7-nightly produces an "OSError: handle is closed" in the
5552
# bowels of multiprocessing after all tests appear to complete successfully
5653
# - python: '3.7' # <- not actually used

ci.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,6 @@ EOF
103103
exit 1
104104
fi
105105
exit 0
106-
fi
107-
108-
if [ "$CHECK_DOCS" = "1" ]; then
109-
python -m pip install -r docs-requirements.txt
110-
cd docs
111-
# -n (nit-picky): warn on missing references
112-
# -W: turn warnings into errors
113-
sphinx-build -nW -b html source build
114106
else
115107
# Actual tests
116108
python -m pip install -r test-requirements.txt

docs-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
sphinx >= 1.7.0
22
sphinx_rtd_theme
33
sphinxcontrib-trio
4+
towncrier
45
trio >= 0.15.0
56
outcome
67
attrs

docs/source/conf.py

100644100755
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@
2222
# So autodoc can import our package
2323
sys.path.insert(0, os.path.abspath('../..'))
2424

25+
# https://docs.readthedocs.io/en/stable/builds.html#build-environment
26+
if "READTHEDOCS" in os.environ:
27+
import glob
28+
if glob.glob("../../newsfragments/*.*.rst"):
29+
print("-- Found newsfragments; running towncrier --", flush=True)
30+
import subprocess
31+
subprocess.run(
32+
["towncrier", "--yes", "--date", "not released yet"],
33+
cwd="../..",
34+
check=True,
35+
)
36+
2537
# Warn about all references to unknown targets
2638
nitpicky = True
2739
# Except for these ones, which we expect to point to unknown targets:

newsfragments/99.bugfix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:func:`asyncio.get_running_loop()` will now return the trio-asyncio event loop
2+
(if running), instead of failing with :exc:`RuntimeError`.

tests/test_trio_asyncio.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,14 @@ async def test_half_fixtured_asyncpg_conn(asyncio_fixture_own_loop):
3636
@pytest.mark.trio
3737
async def test_fixtured_asyncpg_conn(asyncio_fixture_with_fixtured_loop):
3838
await use_asyncio()
39+
40+
41+
@pytest.mark.trio
42+
async def test_get_running_loop():
43+
async with trio_asyncio.open_loop() as loop:
44+
try:
45+
from asyncio import get_running_loop
46+
except ImportError:
47+
pass # Python 3.6
48+
else:
49+
assert get_running_loop() == loop

trio_asyncio/_loop.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ def _new_run_get_or_throw():
249249

250250
_aio_event._get_running_loop = _new_run_get
251251
_aio_event.get_running_loop = _new_run_get_or_throw
252+
asyncio._get_running_loop = _new_run_get
253+
asyncio.get_running_loop = _new_run_get_or_throw
252254

253255
#####
254256

0 commit comments

Comments
 (0)