Skip to content
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
install_requires=[
"attrs >= 19.2.0", # for eq
"sortedcontainers",
"async_generator >= 1.9",
"contextlib2; python_version < '3.10'",
"idna",
"outcome",
"sniffio",
Expand Down
17 changes: 9 additions & 8 deletions test-requirements.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# For tests
pytest >= 5.0 # for faulthandler in core
pytest >= 5.0 # for faulthandler in core
pytest-cov >= 2.6.0
ipython # for the IPython traceback integration tests
pyOpenSSL # for the ssl tests
trustme # for the ssl tests
pylint # for pylint finding all symbols tests
jedi # for jedi code completion tests
cryptography>=36.0.0 # 35.0.0 is transitive but fails
ipython # for the IPython traceback integration tests
pyOpenSSL # for the ssl tests
trustme # for the ssl tests
pylint # for pylint finding all symbols tests
jedi # for jedi code completion tests
cryptography>=36.0.0 # 35.0.0 is transitive but fails
async_generator >= 1.9 # for testing against py3.5 style async generator wrappers

# Tools
black; implementation_name == "cpython"
Expand All @@ -24,7 +25,7 @@ typing-extensions; implementation_name == "cpython"
cffi; os_name == "nt"
attrs >= 19.2.0
sortedcontainers
async_generator >= 1.9
contextlib2; python_version < '3.10'
idna
outcome
sniffio
5 changes: 2 additions & 3 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ cffi==1.15.0
# via cryptography
click==8.0.3
# via black
contextlib2==21.6.0 ; python_version < "3.10"
# via -r test-requirements.in
coverage[toml]==6.0.2
# via pytest-cov
cryptography==36.0.1
Expand All @@ -38,8 +40,6 @@ idna==3.3
# via
# -r test-requirements.in
# trustme
immutables==0.16
# via -r test-requirements.in
importlib-metadata==4.2.0
# via
# click
Expand Down Expand Up @@ -149,7 +149,6 @@ typing-extensions==3.10.0.2 ; implementation_name == "cpython"
# -r test-requirements.in
# astroid
# black
# immutables
# importlib-metadata
# mypy
# pylint
Expand Down
4 changes: 1 addition & 3 deletions trio/_core/_ki.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from functools import wraps
import attr

import async_generator

from .._util import is_main_thread

if False:
Expand Down Expand Up @@ -141,7 +139,7 @@ def wrapper(*args, **kwargs):
return gen

return wrapper
elif async_generator.isasyncgenfunction(fn):
elif inspect.isasyncgenfunction(fn):

@wraps(fn)
def wrapper(*args, **kwargs):
Expand Down
7 changes: 5 additions & 2 deletions trio/_core/tests/test_asyncgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
import weakref
import pytest
from math import inf
from functools import partial
from async_generator import aclosing
from ... import _core
from .tutil import gc_collect_harder, buggy_pypy_asyncgens, restore_unraisablehook

if sys.version_info >= (3, 10):
from contextlib import aclosing
else:
from contextlib2 import aclosing


def test_asyncgen_basics():
collected = []
Expand Down
13 changes: 3 additions & 10 deletions trio/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
from abc import ABCMeta
import os
import signal
import sys
import pathlib
from functools import wraps, update_wrapper
from functools import update_wrapper
import typing as t
import threading
import collections

from async_generator import isasyncgen
from inspect import isasyncgen

import trio

Expand Down Expand Up @@ -334,8 +331,4 @@ def name_asyncgen(agen):
module = agen.ag_frame.f_globals["__name__"]
except (AttributeError, KeyError):
module = "<{}>".format(agen.ag_code.co_filename)
try:
qualname = agen.__qualname__
except AttributeError:
qualname = agen.ag_code.co_name
return f"{module}.{qualname}"
return f"{module}.{agen.__qualname__}"
2 changes: 1 addition & 1 deletion trio/testing/_sequencer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from collections import defaultdict
from contextlib import asynccontextmanager

import attr
from async_generator import asynccontextmanager

from .. import _core
from .. import _util
Expand Down
3 changes: 1 addition & 2 deletions trio/tests/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
import threading
import socket as stdlib_socket
import ssl
from contextlib import contextmanager
from contextlib import asynccontextmanager, contextmanager
from functools import partial

from OpenSSL import SSL
import trustme
from async_generator import asynccontextmanager

import trio
from .. import _core
Expand Down
2 changes: 1 addition & 1 deletion trio/tests/test_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import signal
import subprocess
import sys
from contextlib import asynccontextmanager
from functools import partial
from pathlib import Path as SyncPath

import pytest
from async_generator import asynccontextmanager

from .. import (
ClosedResourceError,
Expand Down