diff --git a/pyproject.toml b/pyproject.toml index b4bdb68..09a94b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -99,5 +99,8 @@ ] line-length = 99 +[tool.ruff.isort] + required-imports = ["from __future__ import annotations"] + [tool.ruff.per-file-ignores] "tests/**/*.py" = ["ANN"] # TODO: tests are missing type annotations diff --git a/tests/conftest.py b/tests/conftest.py index aa1bac8..414e127 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,6 +3,8 @@ https://github.com/sphinx-doc/sphinx/issues/7008), so this setup was created using the given code snippets and the existing test cases for the autodoc extension. """ +from __future__ import annotations + from unittest.mock import Mock import pytest diff --git a/tests/roots/test-docstrings/conf.py b/tests/roots/test-docstrings/conf.py index e4e6cf8..b490aac 100644 --- a/tests/roots/test-docstrings/conf.py +++ b/tests/roots/test-docstrings/conf.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import os import sys diff --git a/tests/roots/test-docstrings/conflicting_sphinx_extension.py b/tests/roots/test-docstrings/conflicting_sphinx_extension.py index f18a290..7a5204a 100644 --- a/tests/roots/test-docstrings/conflicting_sphinx_extension.py +++ b/tests/roots/test-docstrings/conflicting_sphinx_extension.py @@ -1,3 +1,6 @@ +from __future__ import annotations + + def setup(app): """ Sphinx extension which also registers a "setting" directive diff --git a/tests/roots/test-docstrings/dummy_django_app/settings.py b/tests/roots/test-docstrings/dummy_django_app/settings.py index 256e7e2..b5523dc 100644 --- a/tests/roots/test-docstrings/dummy_django_app/settings.py +++ b/tests/roots/test-docstrings/dummy_django_app/settings.py @@ -1,6 +1,7 @@ """ Dummy Django settings file """ +from __future__ import annotations SECRET_KEY = "dummy-key" diff --git a/tests/test_attribute_docstrings.py b/tests/test_attribute_docstrings.py index 3b582c3..1fdcdc6 100644 --- a/tests/test_attribute_docstrings.py +++ b/tests/test_attribute_docstrings.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest try: diff --git a/tests/test_autodoc_skip.py b/tests/test_autodoc_skip.py index 0f8fd7b..b6d195c 100644 --- a/tests/test_autodoc_skip.py +++ b/tests/test_autodoc_skip.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest diff --git a/tests/test_class_docstrings.py b/tests/test_class_docstrings.py index 960f24e..40bf3ae 100644 --- a/tests/test_class_docstrings.py +++ b/tests/test_class_docstrings.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest diff --git a/tests/test_data_docstrings.py b/tests/test_data_docstrings.py index 08488be..eaf53b4 100644 --- a/tests/test_data_docstrings.py +++ b/tests/test_data_docstrings.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest diff --git a/tests/test_django_configured.py b/tests/test_django_configured.py index 876448e..aa46ba7 100644 --- a/tests/test_django_configured.py +++ b/tests/test_django_configured.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest diff --git a/tests/test_django_setup.py b/tests/test_django_setup.py index b98cb52..89b06f1 100644 --- a/tests/test_django_setup.py +++ b/tests/test_django_setup.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest from sphinx.errors import ConfigError diff --git a/tests/test_method_docstrings.py b/tests/test_method_docstrings.py index 6efeafb..87186c0 100644 --- a/tests/test_method_docstrings.py +++ b/tests/test_method_docstrings.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest diff --git a/tests/test_roles.py b/tests/test_roles.py index 0e2718e..28c6be8 100644 --- a/tests/test_roles.py +++ b/tests/test_roles.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest