Require the PEP 563 'annotations' future import

This commit is contained in:
Adam Turner
2024-11-22 21:54:26 +00:00
parent 0e15ad7f33
commit 3af48520d2
122 changed files with 294 additions and 17 deletions

View File

@@ -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"""

View File

@@ -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"""

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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',

View File

@@ -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

View File

@@ -1,5 +1,7 @@
"""Test the autodoc extension."""
from __future__ import annotations
import pytest
from tests.test_extensions.autodoc_util import do_autodoc

View File

@@ -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

View File

@@ -1,5 +1,7 @@
"""Test sphinx.ext.autosectionlabel extension."""
from __future__ import annotations
import re
import pytest

View File

@@ -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()

View File

@@ -1,5 +1,7 @@
"""Test autosummary for import cycles."""
from __future__ import annotations
import pytest
from docutils import nodes

View File

@@ -1,5 +1,7 @@
"""Test the coverage builder."""
from __future__ import annotations
import pickle
import pytest

View File

@@ -1,5 +1,7 @@
"""Test the doctest extension."""
from __future__ import annotations
import os
from collections import Counter

View File

@@ -1,5 +1,7 @@
"""Test sphinx.ext.duration extension."""
from __future__ import annotations
import re
import pytest

View File

@@ -1,3 +1,5 @@
from __future__ import annotations
import pytest

View File

@@ -1,5 +1,7 @@
"""Test sphinx.ext.githubpages extension."""
from __future__ import annotations
import pytest

View File

@@ -1,5 +1,7 @@
"""Test sphinx.ext.graphviz extension."""
from __future__ import annotations
import re
import sys

View File

@@ -1,5 +1,7 @@
"""Test sphinx.ext.ifconfig extension."""
from __future__ import annotations
import docutils.utils
import pytest

View File

@@ -1,5 +1,7 @@
"""Test sphinx.ext.imgconverter extension."""
from __future__ import annotations
import subprocess
import pytest

View File

@@ -1,5 +1,7 @@
"""Test image converter with identical basenames"""
from __future__ import annotations
import pytest

View File

@@ -1,5 +1,7 @@
"""Test sphinx.ext.inheritance_diagram extension."""
from __future__ import annotations
import re
import sys
import zlib

View File

@@ -1,5 +1,7 @@
"""Test math extensions."""
from __future__ import annotations
import re
import shutil
import subprocess

View File

@@ -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

View File

@@ -1,5 +1,7 @@
"""Tests for :mod:`sphinx.ext.napoleon.docstring` module."""
from __future__ import annotations
import re
import zlib
from collections import namedtuple

View File

@@ -1,5 +1,7 @@
"""Test sphinx.ext.todo extension."""
from __future__ import annotations
import re
import pytest

View File

@@ -1,5 +1,7 @@
"""Test sphinx.extension module."""
from __future__ import annotations
import pytest
from sphinx.errors import VersionRequirementError