diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a85e3c8fb75..0159ac34db3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - name: [py35, py36, py37] + name: [py35, py36, py37, py38, py39] include: - name: py35 python: 3.5 @@ -19,6 +19,15 @@ jobs: - name: py37 python: 3.7 docutils: du14 + - name: py38 + python: 3.8 + docutils: du15 + - name: py39 + python: 3.9 + docutils: du16 + coverage: "--cov ./ --cov-append --cov-config setup.cfg" + env: + PYTEST_ADDOPTS: ${{ matrix.coverage }} steps: - uses: actions/checkout@v2 @@ -31,9 +40,12 @@ jobs: - name: Install graphviz run: sudo apt-get install graphviz - name: Install dependencies - run: pip install -U tox + run: pip install -U tox codecov - name: Run Tox run: tox -e ${{ matrix.docutils }} -- -vv + - name: codecov + uses: codecov/codecov-action@v1 + if: matrix.coverage windows: runs-on: windows-latest diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 00000000000..d7a7c95f14b --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,21 @@ +name: CI (node.js) + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + env: + node-version: 10.7 + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ env.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ env.node-version }} + - run: npm install + - name: Run headless test + uses: GabrielBB/xvfb-action@v1 + with: + run: npm test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4123ba6b59a..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,34 +0,0 @@ -os: linux -dist: xenial -language: python -cache: pip - -env: - global: - - PYTHONFAULTHANDLER=x - - SKIP_LATEX_BUILD=1 - - IS_PYTHON=true - -jobs: - include: - - python: '3.8' - env: - - TOXENV=du15 - - PYTEST_ADDOPTS="--cov ./ --cov-append --cov-config setup.cfg" - - - language: node_js - node_js: '10.7' - env: IS_PYTHON=false - services: xvfb - -install: - - "sudo apt-get install graphviz" - - if [ $IS_PYTHON = true ]; then pip install -U tox codecov; fi - - if [ $IS_PYTHON = false ]; then npm install; fi - -script: - - if [ $IS_PYTHON = true ]; then tox -- -vv; fi - - if [ $IS_PYTHON = false ]; then npm test; fi - -after_success: - - if [[ -e .coverage ]]; then codecov -e $TOXENV; fi diff --git a/CHANGES b/CHANGES index 37cb75a9cfc..55c0a833e52 100644 --- a/CHANGES +++ b/CHANGES @@ -26,6 +26,7 @@ Bugs fixed ---------- * #7613: autodoc: autodoc does not respect __signature__ of the class +* #4606: autodoc: the location of the warning is incorrect for inherited method * #8105: autodoc: the signature of class constructor is incorrect if the class is decorated diff --git a/doc/internals/contributing.rst b/doc/internals/contributing.rst index 1f4a31013e0..a52e6e72d6d 100644 --- a/doc/internals/contributing.rst +++ b/doc/internals/contributing.rst @@ -272,9 +272,9 @@ identifier and put ``sphinx.po`` in there. Don't forget to update the possible values for :confval:`language` in ``doc/usage/configuration.rst``. The Sphinx core messages can also be translated on `Transifex -`_. There ``tx`` client tool, which is -provided by the ``transifex_client`` Python package, can be used to pull -translations in ``.po`` format from Transifex. To do this, go to +`_. There ``tx`` client tool, +which is provided by the ``transifex_client`` Python package, can be used to +pull translations in ``.po`` format from Transifex. To do this, go to ``sphinx/locale`` and then run ``tx pull -f -l LANG`` where ``LANG`` is an existing language identifier. It is good practice to run ``python setup.py update_catalog`` afterwards to make sure the ``.po`` file has the canonical diff --git a/setup.py b/setup.py index 8505d267972..27bbb3ae038 100644 --- a/setup.py +++ b/setup.py @@ -203,6 +203,7 @@ def _run_domain_js(self, domain): 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Framework :: Setuptools Plugin', diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index 0d26a4f2cec..92b3ad3e710 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -543,9 +543,18 @@ def process_doc(self, docstrings: List[List[str]]) -> Iterator[str]: yield from docstringlines def get_sourcename(self) -> str: + if (getattr(self.object, '__module__', None) and + getattr(self.object, '__qualname__', None)): + # Get the correct location of docstring from self.object + # to support inherited methods + fullname = '%s.%s' % (self.object.__module__, self.object.__qualname__) + else: + fullname = self.fullname + if self.analyzer: - return '%s:docstring of %s' % (self.analyzer.srcname, self.fullname) - return 'docstring of %s' % self.fullname + return '%s:docstring of %s' % (self.analyzer.srcname, fullname) + else: + return 'docstring of %s' % fullname def add_content(self, more_content: Any, no_docstring: bool = False) -> None: """Add content from docstrings, attribute documentation and user.""" diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index 4f8e15c0464..27f478675e1 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -62,14 +62,6 @@ def getargspec(func: Callable) -> Any: methods.""" warnings.warn('sphinx.ext.inspect.getargspec() is deprecated', RemovedInSphinx50Warning, stacklevel=2) - # On 3.5+, signature(int) or similar raises ValueError. On 3.4, it - # succeeds with a bogus signature. We want a TypeError uniformly, to - # match historical behavior. - if (isinstance(func, type) and - is_builtin_class_method(func, "__new__") and - is_builtin_class_method(func, "__init__")): - raise TypeError( - "can't compute signature for built-in type {}".format(func)) sig = inspect.signature(func) diff --git a/tox.ini b/tox.ini index a612999793e..316655d20a0 100644 --- a/tox.ini +++ b/tox.ini @@ -26,7 +26,7 @@ extras = test setenv = PYTHONWARNINGS = all,ignore::ImportWarning:importlib._bootstrap_external,ignore::DeprecationWarning:site,ignore::DeprecationWarning:distutils - PYTEST_ADDOPTS = --color yes + PYTEST_ADDOPTS = {env:PYTEST_ADDOPTS:} --color yes commands= pytest --durations 25 {posargs}