mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Require the PEP 563 'annotations' future import
This commit is contained in:
@@ -295,7 +295,7 @@ select = [
|
||||
"TC001", # documentation doesn't need type-checking blocks
|
||||
]
|
||||
"doc/conf.py" = ["INP001", "W605"]
|
||||
"doc/development/tutorials/examples/*" = ["INP001"]
|
||||
"doc/development/tutorials/examples/*" = ["I002", "INP001"]
|
||||
# allow print() in the tutorial
|
||||
"doc/development/tutorials/examples/recipe.py" = [
|
||||
"FURB118",
|
||||
@@ -360,7 +360,7 @@ select = [
|
||||
|
||||
# these tests need old ``typing`` generic aliases
|
||||
"tests/test_util/test_util_typing.py" = ["UP006", "UP007", "UP035"]
|
||||
"tests/test_util/typing_test_data.py" = ["FA100", "PYI030", "UP006", "UP007", "UP035"]
|
||||
"tests/test_util/typing_test_data.py" = ["FA100", "I002", "PYI030", "UP006", "UP007", "UP035"]
|
||||
|
||||
"utils/*" = [
|
||||
"T201", # whitelist ``print`` for stdout messages
|
||||
@@ -377,6 +377,9 @@ inline-quotes = "single"
|
||||
forced-separate = [
|
||||
"tests",
|
||||
]
|
||||
required-imports = [
|
||||
"from __future__ import annotations",
|
||||
]
|
||||
|
||||
[format]
|
||||
preview = true
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""The Sphinx documentation toolchain."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
__version__ = '8.2.0'
|
||||
__display_version__ = __version__ # used for command line version
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""The Sphinx documentation toolchain."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
|
||||
from sphinx.cmd.build import main
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Additional nodes for LaTeX writer."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from docutils import nodes
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
"""Assets adapter for sphinx.environment."""
|
||||
|
||||
from sphinx.environment import BuildEnvironment
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from sphinx.util._pathlib import _StrPath
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from sphinx.environment import BuildEnvironment
|
||||
|
||||
|
||||
class ImageAdapter:
|
||||
def __init__(self, env: BuildEnvironment) -> None:
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Command line interface for the intersphinx extension."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging as _logging
|
||||
import sys
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Sphinx theme specific highlighting styles."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pygments.style import Style
|
||||
from pygments.styles.friendly import FriendlyStyle
|
||||
from pygments.token import (
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
from docutils import nodes
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from docutils.core import publish_doctree
|
||||
|
||||
from sphinx.application import Sphinx
|
||||
from sphinx.io import SphinxStandaloneReader
|
||||
from sphinx.parsers import RSTParser
|
||||
from sphinx.util.docutils import sphinx_domains
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from docutils import nodes
|
||||
|
||||
from sphinx.application import Sphinx
|
||||
|
||||
|
||||
def parse(app: Sphinx, text: str, docname: str = 'index') -> nodes.document:
|
||||
"""Parse a string as reStructuredText with Sphinx application."""
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
def parse_line_num_spec(spec: str, total: int) -> list[int]:
|
||||
"""Parse a line number spec (such as "1,2,4-6") and return a list of
|
||||
wanted line numbers.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Build phase of Sphinx application."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import IntEnum
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
Reference: https://www.rfc-editor.org/rfc/rfc7231#section-7.1.1.1
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
import warnings
|
||||
from email.utils import parsedate_tz
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test all builders."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import shutil
|
||||
from contextlib import contextmanager
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the ChangesBuilder class."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test dirhtml builder."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import posixpath
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the HTML builder and check output against XPath."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the build process with gettext builder with the test root."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import gettext
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the HTML builder and check output against XPath."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import re
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import ANY, call, patch
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from sphinx.errors import ConfigError
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the HTML builder and check output against XPath."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the HTML builder and check output against XPath."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.test_builders.xpath_html_util import _intradocument_hyperlink_check
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the HTML builder and check output against XPath."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the build process with LaTeX builder with the test root."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import http.server
|
||||
import os
|
||||
import re
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the build process with manpage builder with the test root."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import docutils
|
||||
import pytest
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the build process with Texinfo builder with the test root."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the Builder class."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test copyright year adjustment"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the code-block directive."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from docutils import nodes
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the only directive with the test root."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the other directives."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the patched directives."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from docutils import nodes
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Tests the directives"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from docutils import nodes
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
"""Tests the C Domain"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import itertools
|
||||
import xml.etree.ElementTree as ET
|
||||
import zlib
|
||||
from io import StringIO
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -29,6 +31,9 @@ from sphinx.testing.util import assert_node
|
||||
from sphinx.util.cfamily import DefinitionError
|
||||
from sphinx.writers.text import STDINDENT
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from io import StringIO
|
||||
|
||||
|
||||
class Config:
|
||||
c_id_attributes = ['id_attr', 'LIGHTGBM_C_EXPORT']
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
"""Tests the C++ Domain"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import itertools
|
||||
import re
|
||||
import zlib
|
||||
from io import StringIO
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -30,6 +32,9 @@ from sphinx.testing.util import assert_node
|
||||
from sphinx.util.cfamily import DefinitionError, NoOldIdError
|
||||
from sphinx.writers.text import STDINDENT
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from io import StringIO
|
||||
|
||||
|
||||
def parse(name, string):
|
||||
class Config:
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Tests the JavaScript Domain"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import Mock
|
||||
|
||||
import docutils.utils
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Tests the reStructuredText domain."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from sphinx import addnodes
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Tests the std domain"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the BuildEnvironment class."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the sphinx.environment.adapters.indexentries."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from sphinx.environment.adapters.indexentries import IndexEntries
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Tests for ``record_dependencies``."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the sphinx.environment.adapters.toctree."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from docutils import nodes
|
||||
from docutils.nodes import bullet_list, list_item, literal, reference, title
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from sphinx.errors import ExtensionError
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the EventManager class."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from sphinx.errors import ExtensionError
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test module for napoleon PEP 526 compatibility with google style"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
module_level_var: int = 99
|
||||
"""This is an example module level variable"""
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test module for napoleon PEP 526 compatibility with numpy style"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
module_level_var: int = 99
|
||||
"""This is an example module level variable"""
|
||||
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
"""Test the sphinx.apidoc module."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections import namedtuple
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
|
||||
import sphinx.ext.apidoc
|
||||
from sphinx.ext.apidoc import main as apidoc_main
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pathlib import Path
|
||||
|
||||
_apidoc = namedtuple('_apidoc', 'coderoot,outdir') # NoQA: PYI024
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ This tests mainly the Documenters; the auto directives are tested in a test
|
||||
source file translated by test_build.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.test_extensions.autodoc_util import do_autodoc
|
||||
|
||||
@@ -4,6 +4,8 @@ This tests mainly the Documenters; the auto directives are tested in a test
|
||||
source file translated by test_build.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.test_extensions.autodoc_util import do_autodoc
|
||||
|
||||
@@ -4,6 +4,8 @@ This tests mainly the Documenters; the auto directives are tested in a test
|
||||
source file translated by test_build.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -4,6 +4,8 @@ This tests mainly the Documenters; the auto directives are tested in a test
|
||||
source file translated by test_build.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import inspect
|
||||
import sys
|
||||
import typing
|
||||
|
||||
@@ -4,6 +4,8 @@ This tests mainly the Documenters; the auto directives are tested in a test
|
||||
source file translated by test_build.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.test_extensions.autodoc_util import do_autodoc
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
"""Test the autodoc extension. This tests mainly for config variables"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import platform
|
||||
import sys
|
||||
from collections.abc import Iterator
|
||||
from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -12,6 +13,10 @@ from sphinx.testing import restructuredtext
|
||||
|
||||
from tests.test_extensions.autodoc_util import do_autodoc
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Iterator
|
||||
from pathlib import Path
|
||||
|
||||
skip_py314_segfault = pytest.mark.skipif(
|
||||
sys.version_info[:2] >= (3, 14),
|
||||
reason='Segmentation fault: https://github.com/python/cpython/issues/125017',
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the autodoc extension. This tests mainly for autodoc events"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from sphinx.ext.autodoc import between, cut_lines
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the autodoc extension."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.test_extensions.autodoc_util import do_autodoc
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the autodoc extension. This tests mainly for private-members option."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.test_extensions.autodoc_util import do_autodoc
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test sphinx.ext.autosectionlabel extension."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
"""Test the autosummary extension."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from contextlib import chdir
|
||||
from io import StringIO
|
||||
from typing import TYPE_CHECKING
|
||||
from unittest.mock import Mock, patch
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
import pytest
|
||||
from docutils import nodes
|
||||
@@ -26,6 +28,9 @@ from sphinx.ext.autosummary.generate import main as autogen_main
|
||||
from sphinx.testing.util import assert_node, etree_parse
|
||||
from sphinx.util.docutils import new_document
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
html_warnfile = StringIO()
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test autosummary for import cycles."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from docutils import nodes
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the coverage builder."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pickle
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the doctest extension."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from collections import Counter
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test sphinx.ext.duration extension."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test sphinx.ext.githubpages extension."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test sphinx.ext.graphviz extension."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test sphinx.ext.ifconfig extension."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import docutils.utils
|
||||
import pytest
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test sphinx.ext.imgconverter extension."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test image converter with identical basenames"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test sphinx.ext.inheritance_diagram extension."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import sys
|
||||
import zlib
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test math extensions."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Tests for :mod:`sphinx.ext.napoleon.__init__` module."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import functools
|
||||
from collections import namedtuple
|
||||
from unittest import mock
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Tests for :mod:`sphinx.ext.napoleon.docstring` module."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import zlib
|
||||
from collections import namedtuple
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test sphinx.ext.todo extension."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test sphinx.extension module."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from sphinx.errors import VersionRequirementError
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the Pygments highlighting bridge."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import pygments
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the base build process."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
Runs the text builder in the test root.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import time
|
||||
from io import StringIO
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
from babel.messages import mofile, pofile
|
||||
@@ -19,6 +21,9 @@ from sphinx.testing.util import assert_node, etree_parse
|
||||
from sphinx.util.console import strip_colors
|
||||
from sphinx.util.nodes import NodeMatcher
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from io import StringIO
|
||||
|
||||
_CATALOG_LOCALE = 'xx'
|
||||
|
||||
sphinx_intl = pytest.mark.sphinx(
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test various Sphinx-specific markup extensions."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import warnings
|
||||
from types import SimpleNamespace
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
# adapted from an example of bibliographic metadata at
|
||||
# https://docutils.sourceforge.io/docs/user/rst/demo.txt
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Tests parsers module."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test smart quotes."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from sphinx.testing.util import etree_parse
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Tests project module."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test pycode."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test pycode.ast"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import ast
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test pycode.parser."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from sphinx.pycode.parser import Parser
|
||||
from sphinx.util.inspect import signature_from_str
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"""Test the sphinx.quickstart module."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
from collections.abc import Callable
|
||||
from io import StringIO
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -12,6 +12,10 @@ from sphinx.cmd import quickstart as qs
|
||||
from sphinx.testing.util import SphinxTestApp
|
||||
from sphinx.util.console import coloron, nocolor
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Callable
|
||||
from pathlib import Path
|
||||
|
||||
warnfile = StringIO()
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test sphinx.roles"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test templating."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from sphinx.ext.autosummary.generate import setup_documenters
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Test the Theme class."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from xml.etree.ElementTree import ParseError
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from docutils import nodes
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from types import SimpleNamespace
|
||||
|
||||
from docutils import nodes
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Tests the transformations"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from docutils import nodes
|
||||
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
"""Test the ``UnreferencedFootnotesDetector`` transform."""
|
||||
|
||||
from pathlib import Path
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from sphinx.testing.util import SphinxTestApp
|
||||
from sphinx.util.console import strip_colors
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pathlib import Path
|
||||
|
||||
from sphinx.testing.util import SphinxTestApp
|
||||
|
||||
|
||||
def test_warnings(make_app: type[SphinxTestApp], tmp_path: Path) -> None:
|
||||
"""Test that warnings are emitted for unreferenced footnotes."""
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user