File avoid_contextlib2.patch of Package python-sphinxcontrib-trio
--- a/sphinxcontrib_trio/__init__.py
+++ b/sphinxcontrib_trio/__init__.py
@@ -92,13 +92,6 @@ CM_CODES = set()
from contextlib import contextmanager
CM_CODES.add(contextmanager(None).__code__)
-try:
- from contextlib2 import contextmanager as contextmanager2
-except ImportError:
- pass
-else:
- CM_CODES.add(contextmanager2(None).__code__)
-
extended_function_option_spec = {
"async": directives.flag,
"decorator": directives.flag,
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,6 +1,5 @@
pytest
pytest-cov
async_generator
-contextlib2
lxml
cssselect
--- a/tests/test_sphinxcontrib_trio.py
+++ b/tests/test_sphinxcontrib_trio.py
@@ -14,13 +14,6 @@ from pathlib import Path
import lxml.html
try:
- from contextlib2 import contextmanager as contextmanager2
-except ImportError:
- have_contextmanager2 = False
-else:
- have_contextmanager2 = True
-
-try:
from async_generator import async_generator, yield_
except ImportError:
have_async_generator = False
@@ -108,12 +101,6 @@ def test_sniff_options():
check(cm, "with")
- if have_contextmanager2:
- @contextmanager2
- def cm2(): # pragma: no cover
- yield
- check(cm2, "with")
-
def manual_cm(): # pragma: no cover
pass
manual_cm.__returns_contextmanager__ = True
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -111,9 +111,7 @@ Autodetection heuristics
* ``:with:`` is autodetected for:
* functions decorated with `contextlib.contextmanager
- <https://docs.python.org/3/library/contextlib.html#contextlib.contextmanager>`__
- or `contextlib2.contextmanager
- <https://contextlib2.readthedocs.io/en/stable/#contextlib2.contextmanager>`__,
+ <https://docs.python.org/3/library/contextlib.html#contextlib.contextmanager>`__,
* functions that have an attribute ``__returns_contextmanager__``
with a truthy value.