Hello community,
here is the log from the commit of package python-sphinxcontrib-trio for
openSUSE:Factory checked in at 2020-05-28 09:07:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-sphinxcontrib-trio (Old)
and /work/SRC/openSUSE:Factory/.python-sphinxcontrib-trio.new.3606 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-sphinxcontrib-trio"
Thu May 28 09:07:18 2020 rev:6 rq:806000 version:1.1.2
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-sphinxcontrib-trio/python-sphinxcontrib-trio.changes
2019-06-18 14:47:27.145711396 +0200
+++
/work/SRC/openSUSE:Factory/.python-sphinxcontrib-trio.new.3606/python-sphinxcontrib-trio.changes
2020-05-28 09:07:21.963707434 +0200
@@ -1,0 +2,15 @@
+Fri May 15 23:02:19 UTC 2020 - Benjamin Greiner <[email protected]>
+
+- Update to v1.1.2
+ * Recent version of Sphinx deprecated its ``PyClassmember`` class. We've
+ adjusted sphinxcontrib-trio's internals to stop using it and silence
+ the warning. (gh#python-trio/sphinxcontrib-trio#154)
+- Changelog for v1.1.1
+ * When using autodoc to document a class that has inherited members, we
+ now correctly auto-detect the async-ness and other properties of those
+ inherited methods. (gh#python-trio/sphinxcontrib-trio#19)
+ * Recent versions of Sphinx deprecated its ``PyModulelevel`` class.
+ We've adjusted sphinxcontrib-trio's internals to stop using it.
+ gh#python-trio/sphinxcontrib-trio#138
+
+-------------------------------------------------------------------
Old:
----
sphinxcontrib-trio-1.1.0.tar.gz
New:
----
sphinxcontrib-trio-1.1.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-sphinxcontrib-trio.spec ++++++
--- /var/tmp/diff_new_pack.athbps/_old 2020-05-28 09:07:24.947716381 +0200
+++ /var/tmp/diff_new_pack.athbps/_new 2020-05-28 09:07:24.951716393 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-sphinxcontrib-trio
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,14 +19,14 @@
%define skip_python2 1
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-sphinxcontrib-trio
-Version: 1.1.0
+Version: 1.1.2
Release: 0
Summary: Sphinx extension for documenting Python functions and methods
License: MIT OR Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/python-trio/sphinxcontrib-trio
Source:
https://files.pythonhosted.org/packages/source/s/sphinxcontrib-trio/sphinxcontrib-trio-%{version}.tar.gz
-BuildRequires: %{python_module Sphinx >= 1.6}
+BuildRequires: %{python_module Sphinx >= 1.7}
BuildRequires: %{python_module async_generator}
BuildRequires: %{python_module cssselect}
BuildRequires: %{python_module lxml}
@@ -63,6 +63,7 @@
%files %{python_files}
%doc README.rst
%license LICENSE LICENSE.MIT LICENSE.APACHE2
-%{python_sitelib}/*
+%{python_sitelib}/sphinxcontrib_trio
+%{python_sitelib}/sphinxcontrib_trio-%{version}-*.egg-info
%changelog
++++++ sphinxcontrib-trio-1.1.0.tar.gz -> sphinxcontrib-trio-1.1.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/sphinxcontrib-trio-1.1.0/PKG-INFO
new/sphinxcontrib-trio-1.1.2/PKG-INFO
--- old/sphinxcontrib-trio-1.1.0/PKG-INFO 2019-06-03 09:56:52.000000000
+0200
+++ new/sphinxcontrib-trio-1.1.2/PKG-INFO 2020-05-04 18:44:14.000000000
+0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: sphinxcontrib-trio
-Version: 1.1.0
+Version: 1.1.2
Summary: Make Sphinx better at documenting Python functions and methods
Home-page: https://github.com/python-trio/sphinxcontrib-trio
Author: Nathaniel J. Smith
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/sphinxcontrib-trio-1.1.0/docs/source/index.rst
new/sphinxcontrib-trio-1.1.2/docs/source/index.rst
--- old/sphinxcontrib-trio-1.1.0/docs/source/index.rst 2019-06-03
09:55:51.000000000 +0200
+++ new/sphinxcontrib-trio-1.1.2/docs/source/index.rst 2020-05-04
18:04:09.000000000 +0200
@@ -298,6 +298,30 @@
.. towncrier release notes start
+Sphinxcontrib_Trio 1.1.2 (2020-05-04)
++++++++++++++++++++++++++++++++++++++
+
+Bugfixes
+~~~~~~~~
+
+- Recent version of Sphinx deprecated its ``PyClassmember`` class. We've
+ adjusted sphinxcontrib-trio's internals to stop using it and silence
+ the warning. (`#154
<https://github.com/python-trio/sphinxcontrib-trio/issues/154>`__)
+
+
+Sphinxcontrib_Trio 1.1.1 (2020-03-26)
++++++++++++++++++++++++++++++++++++++
+
+Bugfixes
+~~~~~~~~
+
+- When using autodoc to document a class that has inherited members, we
+ now correctly auto-detect the async-ness and other properties of those
+ inherited methods. (`#19
<https://github.com/python-trio/sphinxcontrib-trio/issues/19>`__)
+- Recent versions of Sphinx deprecated its ``PyModulelevel`` class.
+ We've adjusted sphinxcontrib-trio's internals to stop using it. (`#138
<https://github.com/python-trio/sphinxcontrib-trio/issues/138>`__)
+
+
Sphinxcontrib_Trio 1.1.0 (2019-06-03)
+++++++++++++++++++++++++++++++++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/sphinxcontrib-trio-1.1.0/sphinxcontrib_trio/__init__.py
new/sphinxcontrib-trio-1.1.2/sphinxcontrib_trio/__init__.py
--- old/sphinxcontrib-trio-1.1.0/sphinxcontrib_trio/__init__.py 2019-06-03
09:54:41.000000000 +0200
+++ new/sphinxcontrib-trio-1.1.2/sphinxcontrib_trio/__init__.py 2020-05-04
17:20:04.000000000 +0200
@@ -61,7 +61,17 @@
from docutils.parsers.rst import directives
from sphinx import addnodes
-from sphinx.domains.python import PyModulelevel, PyClassmember
+try:
+ from sphinx.domains.python import PyFunction
+except ImportError:
+ from sphinx.domains.python import PyModulelevel as PyFunction
+from sphinx.domains.python import PyObject
+try:
+ from sphinx.domains.python import PyMethod, PyClassMethod, PyStaticMethod
+except ImportError:
+ from sphinx.domains.python import PyClassmember as PyMethod
+ from sphinx.domains.python import PyClassmember as PyClassMethod
+ from sphinx.domains.python import PyClassmember as PyStaticMethod
from sphinx.ext.autodoc import (
FunctionDocumenter, MethodDocumenter, ClassLevelDocumenter, Options,
ModuleLevelDocumenter
)
@@ -81,21 +91,21 @@
ACM_CODES = set()
from contextlib import contextmanager
-CM_CODES.add(contextmanager(None).__code__)
+CM_CODES.add(contextmanager(None).__code__) # type: ignore
try:
from contextlib2 import contextmanager as contextmanager2
except ImportError:
pass
else:
- CM_CODES.add(contextmanager2(None).__code__)
+ CM_CODES.add(contextmanager2(None).__code__) # type: ignore
try:
from contextlib import asynccontextmanager
except ImportError:
pass
else:
- ACM_CODES.add(asynccontextmanager(None).__code__)
+ ACM_CODES.add(asynccontextmanager(None).__code__) # type: ignore
extended_function_option_spec = {
"async": directives.flag,
@@ -122,7 +132,8 @@
# Extending the basic function and method directives
################################################################
-class ExtendedCallableMixin:
+
+class ExtendedCallableMixin(PyObject): # inherit PyObject to satisfy MyPy
def needs_arglist(self):
if "property" in self.options:
return False
@@ -208,15 +219,31 @@
return ret
-class ExtendedPyFunction(ExtendedCallableMixin, PyModulelevel):
+
+class ExtendedPyFunction(ExtendedCallableMixin, PyFunction):
option_spec = {
- **PyModulelevel.option_spec,
+ **PyFunction.option_spec,
**extended_function_option_spec,
}
-class ExtendedPyMethod(ExtendedCallableMixin, PyClassmember):
+
+class ExtendedPyMethod(ExtendedCallableMixin, PyMethod):
+ option_spec = {
+ **PyMethod.option_spec,
+ **extended_method_option_spec,
+ }
+
+
+class ExtendedPyClassMethod(ExtendedCallableMixin, PyClassMethod):
option_spec = {
- **PyClassmember.option_spec,
+ **PyClassMethod.option_spec,
+ **extended_method_option_spec,
+ }
+
+
+class ExtendedPyStaticMethod(ExtendedCallableMixin, PyStaticMethod):
+ option_spec = {
+ **PyStaticMethod.option_spec,
**extended_method_option_spec,
}
@@ -235,6 +262,7 @@
# the others.
EXCLUSIVE_OPTIONS = {"async", "for", "async-for", "with", "async-with"}
+
def sniff_options(obj):
options = set()
# We walk the __wrapped__ chain to collect properties.
@@ -275,6 +303,7 @@
return options
+
def update_with_sniffed_options(obj, option_dict):
if "no-auto-options" in option_dict:
return
@@ -289,6 +318,7 @@
# with our autodetected attr["for"] = None. So we use setdefault.
option_dict.setdefault(attr, None)
+
def passthrough_option_lines(self, option_spec):
sourcename = self.get_sourcename()
for option in option_spec:
@@ -299,6 +329,7 @@
line = " :{}:".format(option)
self.add_line(line, sourcename)
+
class ExtendedFunctionDocumenter(FunctionDocumenter):
priority = FunctionDocumenter.priority + 1
# You can explicitly set the options in case autodetection fails
@@ -323,6 +354,7 @@
update_with_sniffed_options(self.object, self.options)
return ret
+
class ExtendedMethodDocumenter(MethodDocumenter):
priority = MethodDocumenter.priority + 1
# You can explicitly set the options in case autodetection fails
@@ -345,17 +377,9 @@
# addition to just importing. But we do our own sniffing and just want
# the import, so we un-override it.
ret = ClassLevelDocumenter.import_object(self)
- # If you have a classmethod or staticmethod, then
- #
- # Class.__dict__["name"]
- #
- # returns the classmethod/staticmethod object, but
- #
- # getattr(Class, "name")
- #
- # returns a regular function. We want to detect
- # classmethod/staticmethod, so we need to go through __dict__.
- obj = self.parent.__dict__.get(self.object_name)
+ # Use 'inspect.getattr_static' to properly detect class or static
methods.
+ # This also resolves the MRO entries for subclasses.
+ obj = inspect.getattr_static(self.parent, self.object_name)
# autodoc likes to re-use dicts here for some reason (!?!)
self.options = Options(self.options)
update_with_sniffed_options(obj, self.options)
@@ -369,11 +393,12 @@
# Register everything
################################################################
+
def setup(app):
app.add_directive_to_domain('py', 'function', ExtendedPyFunction)
app.add_directive_to_domain('py', 'method', ExtendedPyMethod)
- app.add_directive_to_domain('py', 'classmethod', ExtendedPyMethod)
- app.add_directive_to_domain('py', 'staticmethod', ExtendedPyMethod)
+ app.add_directive_to_domain('py', 'classmethod', ExtendedPyClassMethod)
+ app.add_directive_to_domain('py', 'staticmethod', ExtendedPyStaticMethod)
app.add_directive_to_domain('py', 'decorator', ExtendedPyFunction)
app.add_directive_to_domain('py', 'decoratormethod', ExtendedPyMethod)
@@ -388,6 +413,8 @@
# A monkey-patch to VariableCommentPicker to make autodoc_member_order =
'bysource' work.
from sphinx.pycode.parser import VariableCommentPicker
if not hasattr(VariableCommentPicker, "visit_AsyncFunctionDef"): #
pragma: no branch
- VariableCommentPicker.visit_AsyncFunctionDef =
VariableCommentPicker.visit_FunctionDef
+ VariableCommentPicker.visit_AsyncFunctionDef = ( # type: ignore
+ VariableCommentPicker.visit_FunctionDef # type: ignore
+ )
return {'version': __version__, 'parallel_read_safe': True}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/sphinxcontrib-trio-1.1.0/sphinxcontrib_trio/_version.py
new/sphinxcontrib-trio-1.1.2/sphinxcontrib_trio/_version.py
--- old/sphinxcontrib-trio-1.1.0/sphinxcontrib_trio/_version.py 2019-06-03
09:55:56.000000000 +0200
+++ new/sphinxcontrib-trio-1.1.2/sphinxcontrib_trio/_version.py 2020-05-04
18:04:09.000000000 +0200
@@ -1 +1 @@
-__version__ = "1.1.0"
+__version__ = "1.1.2"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/sphinxcontrib-trio-1.1.0/sphinxcontrib_trio.egg-info/PKG-INFO
new/sphinxcontrib-trio-1.1.2/sphinxcontrib_trio.egg-info/PKG-INFO
--- old/sphinxcontrib-trio-1.1.0/sphinxcontrib_trio.egg-info/PKG-INFO
2019-06-03 09:56:52.000000000 +0200
+++ new/sphinxcontrib-trio-1.1.2/sphinxcontrib_trio.egg-info/PKG-INFO
2020-05-04 18:44:13.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: sphinxcontrib-trio
-Version: 1.1.0
+Version: 1.1.2
Summary: Make Sphinx better at documenting Python functions and methods
Home-page: https://github.com/python-trio/sphinxcontrib-trio
Author: Nathaniel J. Smith
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/sphinxcontrib-trio-1.1.0/test-requirements.txt
new/sphinxcontrib-trio-1.1.2/test-requirements.txt
--- old/sphinxcontrib-trio-1.1.0/test-requirements.txt 2019-06-03
09:54:41.000000000 +0200
+++ new/sphinxcontrib-trio-1.1.2/test-requirements.txt 2020-05-04
18:04:09.000000000 +0200
@@ -5,41 +5,38 @@
# pip-compile test-requirements.in
#
alabaster==0.7.12 # via sphinx
-async-generator==1.10
-atomicwrites==1.3.0 # via pytest
-attrs==19.1.0 # via pytest
-babel==2.7.0 # via sphinx
-certifi==2019.3.9 # via requests
+async-generator==1.10 # via -r test-requirements.in
+attrs==19.3.0 # via pytest
+babel==2.8.0 # via sphinx
+certifi==2020.4.5.1 # via requests
chardet==3.0.4 # via requests
-contextlib2==0.5.5
-coverage==4.5.3 # via pytest-cov
-cssselect==1.0.3
-docutils==0.14 # via sphinx
-idna==2.8 # via requests
-imagesize==1.1.0 # via sphinx
-importlib-metadata==0.17 # via pluggy, pytest
-jinja2==2.10.1 # via sphinx
-lxml==4.3.3
+contextlib2==0.6.0.post1 # via -r test-requirements.in
+coverage==5.1 # via pytest-cov
+cssselect==1.1.0 # via -r test-requirements.in
+docutils==0.16 # via sphinx
+idna==2.9 # via requests
+imagesize==1.2.0 # via sphinx
+jinja2==2.11.2 # via sphinx
+lxml==4.5.0 # via -r test-requirements.in
markupsafe==1.1.1 # via jinja2
-more-itertools==7.0.0 # via pytest
-packaging==19.0 # via pytest, sphinx
-pluggy==0.12.0 # via pytest
-py==1.8.0 # via pytest
-pygments==2.4.2 # via sphinx
-pyparsing==2.4.0 # via packaging
-pytest-cov==2.7.1
-pytest==4.6.1
-pytz==2019.1 # via babel
-requests==2.22.0 # via sphinx
-six==1.12.0 # via packaging, pytest
-snowballstemmer==1.2.1 # via sphinx
-sphinx==2.1.0
-sphinxcontrib-applehelp==1.0.1 # via sphinx
-sphinxcontrib-devhelp==1.0.1 # via sphinx
-sphinxcontrib-htmlhelp==1.0.2 # via sphinx
+more-itertools==8.2.0 # via pytest
+packaging==20.3 # via pytest, sphinx
+pluggy==0.13.1 # via pytest
+py==1.8.1 # via pytest
+pygments==2.6.1 # via sphinx
+pyparsing==2.4.7 # via packaging
+pytest-cov==2.8.1 # via -r test-requirements.in
+pytest==5.4.1 # via -r test-requirements.in, pytest-cov
+pytz==2020.1 # via babel
+requests==2.23.0 # via sphinx
+six==1.14.0 # via packaging
+snowballstemmer==2.0.0 # via sphinx
+sphinx==3.0.3 # via -r test-requirements.in
+sphinxcontrib-applehelp==1.0.2 # via sphinx
+sphinxcontrib-devhelp==1.0.2 # via sphinx
+sphinxcontrib-htmlhelp==1.0.3 # via sphinx
sphinxcontrib-jsmath==1.0.1 # via sphinx
-sphinxcontrib-qthelp==1.0.2 # via sphinx
-sphinxcontrib-serializinghtml==1.1.3 # via sphinx
-urllib3==1.25.3 # via requests
-wcwidth==0.1.7 # via pytest
-zipp==0.5.1 # via importlib-metadata
+sphinxcontrib-qthelp==1.0.3 # via sphinx
+sphinxcontrib-serializinghtml==1.1.4 # via sphinx
+urllib3==1.25.9 # via requests
+wcwidth==0.1.9 # via pytest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/sphinxcontrib-trio-1.1.0/tests/test-docs-source/autodoc_examples.py
new/sphinxcontrib-trio-1.1.2/tests/test-docs-source/autodoc_examples.py
--- old/sphinxcontrib-trio-1.1.0/tests/test-docs-source/autodoc_examples.py
2019-06-03 09:54:41.000000000 +0200
+++ new/sphinxcontrib-trio-1.1.2/tests/test-docs-source/autodoc_examples.py
2020-03-25 17:05:02.000000000 +0100
@@ -1,11 +1,14 @@
import abc
+
def basic():
pass
+
async def asyncfn(x):
pass
+
def gen():
yield
@@ -13,6 +16,7 @@
# - there's the :members: option
# - how you access the attributes matters
+
class ExampleClass(abc.ABC):
@abc.abstractmethod
def abstractmethod_(self):
@@ -34,6 +38,7 @@
def property_(self):
pass
+
class ExampleClassForOrder:
async def d_asyncmethod(self):
pass
@@ -48,5 +53,13 @@
pass
+class ExampleInheritedSubclass(ExampleClassForOrder):
+ def a_syncmethod(self):
+ pass
+
+ async def c_asyncmethod(self):
+ pass
+
+
async def autosummary_me():
pass
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/sphinxcontrib-trio-1.1.0/tests/test-docs-source/test.rst
new/sphinxcontrib-trio-1.1.2/tests/test-docs-source/test.rst
--- old/sphinxcontrib-trio-1.1.0/tests/test-docs-source/test.rst
2019-06-03 09:54:41.000000000 +0200
+++ new/sphinxcontrib-trio-1.1.2/tests/test-docs-source/test.rst
2020-05-04 18:04:09.000000000 +0200
@@ -4,7 +4,7 @@
Each ``note`` in this file is a test case. The ``test_end_to_end``
function in ``test_sphinxcontrib_trio.py`` loops through the rendered
-output of each ``note``, and for eacn one it finds all the "none"
+output of each ``note``, and for each one it finds all the "none"
code-blocks, and it makes sure that the contents of that code-block
appears in the html source for the rest of the note.
@@ -21,6 +21,7 @@
.. note::
.. function:: foo(bar)
+ :noindex:
:async:
.. code-block:: none
@@ -31,6 +32,7 @@
.. warning::
.. function:: foo(bar)
+ :noindex:
.. code-block:: none
@@ -43,6 +45,7 @@
.. note::
.. method:: foo(bar)
+ :noindex:
:abstractmethod:
:staticmethod:
:async:
@@ -55,6 +58,7 @@
.. note::
.. method:: foo(bar)
+ :noindex:
:classmethod:
.. code-block:: none
@@ -65,6 +69,7 @@
.. note::
.. function:: foo(bar)
+ :noindex:
:with:
.. code-block:: none
@@ -75,15 +80,17 @@
.. note::
.. method:: foo(bar)
+ :noindex:
:with: baz
.. code-block:: none
- <em class="property">with </em><code class="(sig-name
)?descname">foo</code><span class="sig-paren">\(</span><em(
class="sig-param")?>bar</em><span class="sig-paren">\)</span><em
class="property"> as baz</em>
+ <em class="property">with </em><code class="(sig-name
)?descname">foo</code><span class="sig-paren">\(</span><em(
class="sig-param")?>(<span class="n">)?bar(</span>)?</em><span
class="sig-paren">\)</span><em class="property"> as baz</em>
.. note::
.. method:: foo(bar)
+ :noindex:
:async-with:
.. code-block:: none
@@ -94,11 +101,12 @@
.. note::
.. method:: foo(bar)
+ :noindex:
:async-with: baz
.. code-block:: none
- <em class="property">async with </em><code class="(sig-name
)?descname">foo</code><span class="sig-paren">\(</span><em(
class="sig-param")?>bar</em><span class="sig-paren">\)</span><em
class="property"> as baz</em>
+ <em class="property">async with </em><code class="(sig-name
)?descname">foo</code><span class="sig-paren">\(</span><em(
class="sig-param")?>(<span class="n">)?bar(</span>)?</em><span
class="sig-paren">\)</span><em class="property"> as baz</em>
This one checks that decorators don't normally have parentheses:
@@ -106,6 +114,7 @@
.. note::
.. decorator:: foo
+ :noindex:
.. code-block:: none
@@ -117,10 +126,11 @@
.. note::
.. decorator:: foo(bar)
+ :noindex:
.. code-block:: none
- <code class="(sig-prename )?descclassname">@</code><code
class="(sig-name )?descname">foo</code><span class="sig-paren">\(</span><em(
class="sig-param")?>bar</em>
+ <code class="(sig-prename )?descclassname">@</code><code
class="(sig-name )?descname">foo</code><span class="sig-paren">\(</span><em(
class="sig-param")?>(<span class="n">)?bar(</span>)?</em>
Same for properties, in case someone uses `.. method:: :property:`
@@ -129,6 +139,7 @@
.. note::
.. method:: foo()
+ :noindex:
:property:
.. code-block:: none
@@ -139,6 +150,7 @@
.. note::
.. method:: foo(bar)
+ :noindex:
:for:
.. code-block:: none
@@ -149,6 +161,7 @@
.. note::
.. method:: foo(bar)
+ :noindex:
:for: baz
.. code-block:: none
@@ -158,6 +171,7 @@
.. note::
.. method:: foo(bar)
+ :noindex:
:async-for:
.. code-block:: none
@@ -168,6 +182,7 @@
.. note::
.. method:: foo(bar)
+ :noindex:
:async-for: baz
.. code-block:: none
@@ -181,6 +196,7 @@
.. note::
.. decorator:: foo
+ :noindex:
.. code-block:: none
@@ -189,6 +205,7 @@
.. note::
.. decoratormethod:: foo
+ :noindex:
.. code-block:: none
@@ -197,6 +214,7 @@
.. note::
.. classmethod:: foo(bar)
+ :noindex:
.. code-block:: none
@@ -205,6 +223,7 @@
.. note::
.. staticmethod:: foo(bar)
+ :noindex:
.. code-block:: none
@@ -221,6 +240,7 @@
.. note::
.. autofunction:: basic
+ :noindex:
.. code-block:: none
@@ -229,6 +249,7 @@
.. warning::
.. autofunction:: basic
+ :noindex:
.. code-block:: none
@@ -237,6 +258,7 @@
.. note::
.. autofunction:: asyncfn
+ :noindex:
.. code-block:: none
@@ -253,6 +275,7 @@
.. note::
.. autoclass:: ExampleClass
+ :noindex:
:members:
:undoc-members:
@@ -279,12 +302,47 @@
:members:
:undoc-members:
+Autodoc + inherited methods:
+
+.. note::
+
+ .. autoclass:: ExampleInheritedSubclass
+ :noindex:
+ :members:
+ :undoc-members:
+ :inherited-members:
+
+ .. code-block:: none
+
+ <em class="property">await </em><code class="(sig-name
)?descname">c_asyncmethod</code>
+
+ .. code-block:: none
+
+ <em class="property">await </em><code class="(sig-name
)?descname">d_asyncmethod</code>
+
+.. warning::
+
+ .. autoclass:: ExampleInheritedSubclass
+ :noindex:
+ :members:
+ :undoc-members:
+ :inherited-members:
+
+ .. code-block:: none
+
+ <em class="property">await </em><code class="(sig-name
)?descname">a_syncmethod</code>
+
+ .. code-block:: none
+
+ <em class="property">await </em><code class="(sig-name
)?descname">b_syncmethod</code>
+
Autodoc + explicit options:
.. note::
.. autofunction:: basic
+ :noindex:
:for:
:async:
@@ -297,6 +355,7 @@
.. note::
.. autofunction:: gen
+ :noindex:
.. code-block:: none
@@ -305,6 +364,7 @@
.. note::
.. autofunction:: gen
+ :noindex:
:for: arg
.. code-block:: none
@@ -316,6 +376,7 @@
.. note::
.. autofunction:: gen
+ :noindex:
:no-auto-options:
.. code-block:: none
@@ -326,6 +387,7 @@
.. warning::
.. autofunction:: gen
+ :noindex:
:no-auto-options:
.. code-block:: none
@@ -335,6 +397,7 @@
.. note::
.. autofunction:: gen
+ :noindex:
:no-auto-options:
:for:
@@ -345,6 +408,7 @@
.. note::
.. autofunction:: gen
+ :noindex:
:no-auto-options:
:async:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/sphinxcontrib-trio-1.1.0/tests/test_sphinxcontrib_trio.py
new/sphinxcontrib-trio-1.1.2/tests/test_sphinxcontrib_trio.py
--- old/sphinxcontrib-trio-1.1.0/tests/test_sphinxcontrib_trio.py
2019-06-03 09:54:41.000000000 +0200
+++ new/sphinxcontrib-trio-1.1.2/tests/test_sphinxcontrib_trio.py
2020-03-25 17:05:02.000000000 +0100
@@ -1,16 +1,14 @@
-import pytest
-
-import subprocess
-import os.path
-import sys
-import textwrap
+import re
import abc
-from contextlib import contextmanager
-from functools import wraps
-import difflib
+import sys
import shutil
+import inspect
+import textwrap
+import subprocess
from pathlib import Path
-import re
+from functools import wraps
+from typing import Callable, cast
+from contextlib import contextmanager
import lxml.html
@@ -38,11 +36,13 @@
from sphinxcontrib_trio import sniff_options
if sys.version_info >= (3, 6):
+ agen_native = cast(Callable, lambda: None) # satisfy linter
exec(textwrap.dedent("""
async def agen_native():
yield
"""))
+
def test_sniff_options():
def check(obj, *expected):
__tracebackhide__ = True
@@ -57,7 +57,7 @@
pass
@classmethod
- def b(self):
+ def b(cls):
pass
@staticmethod
@@ -65,13 +65,13 @@
pass
@classmethod
- async def classasync(self):
+ async def classasync(cls):
pass
- check(Basic.__dict__["a"])
- check(Basic.__dict__["b"], "classmethod")
- check(Basic.__dict__["c"], "staticmethod")
- check(Basic.__dict__["classasync"], "classmethod", "async")
+ check(inspect.getattr_static(Basic, "a"))
+ check(inspect.getattr_static(Basic, "b"), "classmethod")
+ check(inspect.getattr_static(Basic, "c"), "staticmethod")
+ check(inspect.getattr_static(Basic, "classasync"), "classmethod", "async")
class Abstract(abc.ABC): # pragma: no cover
@abc.abstractmethod
@@ -88,10 +88,12 @@
async def abstaticasync(self):
pass
- check(Abstract.__dict__["abmeth"], "abstractmethod")
- check(Abstract.__dict__["abstatic"], "abstractmethod", "staticmethod")
- check(Abstract.__dict__["abstaticasync"],
- "abstractmethod", "staticmethod", "async")
+ check(inspect.getattr_static(Abstract, "abmeth"), "abstractmethod")
+ check(inspect.getattr_static(Abstract, "abstatic"), "abstractmethod",
"staticmethod")
+ check(
+ inspect.getattr_static(Abstract, "abstaticasync"),
+ "abstractmethod", "staticmethod", "async",
+ )
async def async_fn(): # pragma: no cover
pass
@@ -124,12 +126,12 @@
def manual_cm(): # pragma: no cover
pass
- manual_cm.__returns_contextmanager__ = True
+ manual_cm.__returns_contextmanager__ = True # type: ignore
check(manual_cm, "with")
def manual_acm(): # pragma: no cover
pass
- manual_acm.__returns_acontextmanager__ = True
+ manual_acm.__returns_acontextmanager__ = True # type: ignore
check(manual_acm, "async-with")
if have_async_generator:
@@ -140,7 +142,7 @@
@wraps(acm_gen)
def acm_wrapped(): # pragma: no cover
pass
- acm_wrapped.__returns_acontextmanager__ = True
+ acm_wrapped.__returns_acontextmanager__ = True # type: ignore
check(acm_wrapped, "async-with")
@@ -151,21 +153,28 @@
# A chain with complex overrides. We ignore the intermediate generator and
# async function, because the outermost one is a contextmanager -- but we
# still pick up the staticmethod at the end of the chain.
- @staticmethod
+ @staticmethod # type: ignore
def messy0(): # pragma: no cover
pass
+
async def messy1(): # pragma: no cover
pass
- messy1.__wrapped__ = messy0
+
+ messy1.__wrapped__ = messy0 # type: ignore
+
def messy2(): # pragma: no cover
yield
- messy2.__wrapped__ = messy1
+
+ messy2.__wrapped__ = messy1 # type: ignore
+
def messy3(): # pragma: no cover
pass
- messy3.__wrapped__ = messy2
- messy3.__returns_contextmanager__ = True
+
+ messy3.__wrapped__ = messy2 # type: ignore
+ messy3.__returns_contextmanager__ = True # type: ignore
check(messy3, "with", "staticmethod")
+
# Hopefully the next sphinx release will have dedicated pytest-based testing
# utilities:
#
@@ -182,9 +191,9 @@
tree = lxml.html.parse(str(tmpdir / "out" / "test.html")).getroot()
- def do_html_test(node):
+ def do_html_test(node, *, expect_match):
original_content = node.text_content()
- print("-- test case --\n", lxml.html.tostring(node,
encoding="unicode"))
+ print("\n-- test case --\n", lxml.html.tostring(node,
encoding="unicode"))
check_tags = node.cssselect(".highlight-none")
checks = []
@@ -207,8 +216,11 @@
test_content = test_content.replace("\u2026", "...")
for check in checks:
try:
- assert re.search(check, test_content) is not None
- except:
+ if expect_match:
+ assert re.search(check, test_content) is not None
+ else:
+ assert re.search(check, test_content) is None
+ except AssertionError:
print("failed check")
print()
print(repr(check))
@@ -221,13 +233,12 @@
print("\n-- NEGATIVE (WARNING) TESTS --\n")
for warning in tree.cssselect(".warning"):
- with pytest.raises(AssertionError):
- do_html_test(warning)
+ do_html_test(warning, expect_match=False)
print("\n-- POSITIVE (NOTE) TESTS --\n")
for note in tree.cssselect(".note"):
- do_html_test(note)
+ do_html_test(note, expect_match=True)
def test_member_order(tmpdir):
@@ -242,7 +253,9 @@
print("\n-- test case member order by source. --\n")
- methods =
tree.cssselect(r"#autodoc_examples\.ExampleClassForOrder")[0].getnext().cssselect("dt")
+ methods = (
+
tree.cssselect(r"#autodoc_examples\.ExampleClassForOrder")[0].getnext().cssselect("dt")
+ )
names = [method.get("id").split(".")[-1] for method in methods]