summaryrefslogtreecommitdiffstats
path: root/tests/test_application.py
diff options
context:
space:
mode:
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")