summaryrefslogtreecommitdiffstats
path: root/tests/test_application.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-05 16:20:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-05 16:20:58 +0000
commit5bb0bb4be543fd5eca41673696a62ed80d493591 (patch)
treead2c464f140e86c7f178a6276d7ea4a93e3e6c92 /tests/test_application.py
parentAdding upstream version 7.2.6. (diff)
downloadsphinx-5bb0bb4be543fd5eca41673696a62ed80d493591.tar.xz
sphinx-5bb0bb4be543fd5eca41673696a62ed80d493591.zip
Adding upstream version 7.3.7.upstream/7.3.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_application.py')
-rw-r--r--tests/test_application.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/test_application.py b/tests/test_application.py
index a0fe268..1fc49d6 100644
--- a/tests/test_application.py
+++ b/tests/test_application.py
@@ -1,9 +1,11 @@
"""Test the Sphinx class."""
+from __future__ import annotations
import shutil
import sys
from io import StringIO
from pathlib import Path
+from typing import TYPE_CHECKING
from unittest.mock import Mock
import pytest
@@ -11,11 +13,19 @@ from docutils import nodes
import sphinx.application
from sphinx.errors import ExtensionError
-from sphinx.testing.util import SphinxTestApp, strip_escseq
+from sphinx.testing.util import SphinxTestApp
from sphinx.util import logging
+from sphinx.util.console import strip_colors
+if TYPE_CHECKING:
+ import os
-def test_instantiation(tmp_path_factory, rootdir: str, monkeypatch):
+
+def test_instantiation(
+ tmp_path_factory: pytest.TempPathFactory,
+ rootdir: str | os.PathLike[str] | None,
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
# Given
src_dir = tmp_path_factory.getbasetemp() / 'root'
@@ -70,13 +80,13 @@ def test_emit_with_nonascii_name_node(app, status, warning):
def test_extensions(app, status, warning):
app.setup_extension('shutil')
- warning = strip_escseq(warning.getvalue())
+ warning = strip_colors(warning.getvalue())
assert "extension 'shutil' has no setup() function" in warning
def test_extension_in_blacklist(app, status, warning):
app.setup_extension('sphinxjp.themecore')
- msg = strip_escseq(warning.getvalue())
+ msg = strip_colors(warning.getvalue())
assert msg.startswith("WARNING: the extension 'sphinxjp.themecore' was")