Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
- name: Run Tests
run: nox --non-interactive --session "tests-${{ matrix.python-version }}(sphinx='${{ matrix.sphinx-version }}', sphinx_needs='${{ matrix.sphinx_needs-version }}')" -- --full-trace

lint:
name: Lint
pre-commit:
name: pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -36,6 +36,23 @@ jobs:
python -m pip install poetry nox nox-poetry
- uses: pre-commit/action@v3.0.0

mypy:
name: mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: uv sync
run: |
uv sync --group dev

- name: Run mypy
run: |
uv run mypy

linkcheck:
name: Docs-Linkcheck
runs-on: ubuntu-latest
Expand All @@ -59,7 +76,8 @@ jobs:

needs:
- tests
- lint
- pre-commit
- mypy
- linkcheck

runs-on: ubuntu-latest
Expand Down
56 changes: 48 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ docs = [
]

[dependency-groups]
dev = ["pre-commit~=3.0", "nox>=2025.2.9"]
dev = ["pre-commit~=3.0", "nox>=2025.2.9", "mypy>=1.16.0"]

[tool.flit.module]
name = "sphinxcontrib.test_reports"
Expand Down Expand Up @@ -80,14 +80,54 @@ extend-select = [
]

[tool.mypy]
files = "sphinxcontrib"
packages = ["sphinxcontrib.test_reports"]
strict = true
show_error_codes = true
implicit_reexport = false
namespace_packages = true
# TODO: reactivate below files and fix issues in future PRs
exclude = [
"^sphinxcontrib/test_reports/__init__\\.py$",
"^sphinxcontrib/test_reports/config\\.py$",
"^sphinxcontrib/test_reports/directives/__init__\\.py$",
"^sphinxcontrib/test_reports/directives/test_case\\.py$",
"^sphinxcontrib/test_reports/directives/test_common\\.py$",
"^sphinxcontrib/test_reports/directives/test_env\\.py$",
"^sphinxcontrib/test_reports/directives/test_file\\.py$",
"^sphinxcontrib/test_reports/directives/test_report\\.py$",
"^sphinxcontrib/test_reports/directives/test_results\\.py$",
"^sphinxcontrib/test_reports/directives/test_suite\\.py$",
"^sphinxcontrib/test_reports/environment\\.py$",
"^sphinxcontrib/test_reports/exceptions\\.py$",
"^sphinxcontrib/test_reports/functions",
"^sphinxcontrib/test_reports/jsonparser\\.py$",
"^sphinxcontrib/test_reports/junitparser\\.py$",
"^sphinxcontrib/test_reports/test_reports\\.py$",
]
# Disallow dynamic typing
disallow_any_unimported = true
disallow_any_expr = true
disallow_any_decorated = true
disallow_any_generics = true
disallow_any_explicit = true
disallow_subclassing_any = true
# disallow_any_unimported = true
# disallow_any_explicit = true
# disallow_any_expr = true
# disallow_any_decorated = true

# Disallow untyped definitions and calls
disallow_untyped_calls = true
disallow_untyped_defs = true
# disallow_incomplete_defs = true
# check_untyped_defs = true
# disallow_untyped_decorators = true

# # None and optional handling
# no_implicit_optional = true

# # Configuring warnings
# warn_unused_ignores = true
# warn_no_return = true
# warn_return_any = true
# warn_redundant_casts = true

# # Misc things
# strict_equality = true

# # Config file
# warn_unused_configs = true
6 changes: 4 additions & 2 deletions sphinxcontrib/test_reports/test_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import sphinx
from docutils.parsers.rst import directives
from packaging.version import Version
from sphinx.application import Sphinx
from sphinx.config import Config

# from docutils import nodes
from sphinx_needs.api import add_dynamic_function, add_extra_option, add_need_type
Expand Down Expand Up @@ -37,7 +39,7 @@
VERSION = "1.1.1"


def setup(app):
def setup(app: Sphinx):
"""
Setup following directives:
* test_results
Expand Down Expand Up @@ -167,7 +169,7 @@ def tr_preparation(app, *args):
app.add_directive(app.config.tr_case[0], TestCaseDirective)


def sphinx_needs_update(app, *args):
def sphinx_needs_update(app: Sphinx, config: Config) -> None:
"""
sphinx-needs configuration
"""
Expand Down
Loading