When I use Python 3.13 and sphinx-test-reports 1.3.1, I see random errors when trying import the library (without using it):
/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinxcontrib/test_reports/environment.py:67: RemovedInSphinx90Warning: 'sphinx.builders.html.StandaloneHTMLBuilder.css_files' is deprecated. Check CHANGES for Sphinx API modifications.
elif data_file.split(".")[-1] == "css" and hasattr(app.builder, "css_files"):
/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinxcontrib/test_reports/environment.py:68: RemovedInSphinx90Warning: 'sphinx.builders.html.StandaloneHTMLBuilder.css_files' is deprecated. Check CHANGES for Sphinx API modifications.
css_files = [css.filename for css in app.builder.css_files]
Copying static files for sphinx-test-results custom style support...[100%] --- Logging error ---
Traceback (most recent call last):
File "/home/user_name/.local/share/uv/python/cpython-3.13.6-linux-x86_64-gnu/lib/python3.13/logging/__init__.py", line 1151, in emit
msg = self.format(record)
File "/home/user_name/.local/share/uv/python/cpython-3.13.6-linux-x86_64-gnu/lib/python3.13/logging/__init__.py", line 999, in format
return fmt.format(record)
~~~~~~~~~~^^^^^^^^
File "/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinx/util/logging.py", line 574, in format
return colourise(colour_name, message)
File "/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinx/_cli/util/colour.py", line 58, in colourise
if colour_name.startswith('_') or colour_name in {
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'function' object has no attribute 'startswith'
Call stack:
File "/home/user_name/repo_name/.venv/bin/sphinx-build", line 10, in <module>
sys.exit(main())
File "/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinx/cmd/build.py", line 493, in main
return build_main(argv)
File "/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinx/cmd/build.py", line 432, in build_main
app.build(args.force_all, args.filenames)
File "/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinx/application.py", line 426, in build
self.builder.build_update()
File "/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinx/builders/__init__.py", line 375, in build_update
self.build(
File "/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinx/builders/__init__.py", line 403, in build
updated_docnames = set(self.read())
File "/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinx/builders/__init__.py", line 564, in read
for retval in self.events.emit('env-updated', self.env):
File "/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinx/events.py", line 404, in emit
results.append(listener.handler(self.app, *args))
File "/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinxcontrib/test_reports/environment.py", line 92, in install_styles_static_files
for source_file_path in status_iterator(
File "/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinx/util/display.py", line 53, in status_iterator
logger.info(stringify_func(item), nonl=True, color=color)
File "/home/user_name/.local/share/uv/python/cpython-3.13.6-linux-x86_64-gnu/lib/python3.13/logging/__init__.py", line 1907, in info
self.log(INFO, msg, *args, **kwargs)
File "/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinx/util/logging.py", line 138, in log
super().log(level, msg, *args, **kwargs)
File "/home/user_name/.local/share/uv/python/cpython-3.13.6-linux-x86_64-gnu/lib/python3.13/logging/__init__.py", line 1945, in log
self.logger.log(level, msg, *args, **kwargs)
File "/home/user_name/.local/share/uv/python/cpython-3.13.6-linux-x86_64-gnu/lib/python3.13/logging/__init__.py", line 1590, in log
self._log(level, msg, args, **kwargs)
File "/home/user_name/.local/share/uv/python/cpython-3.13.6-linux-x86_64-gnu/lib/python3.13/logging/__init__.py", line 1665, in _log
self.handle(record)
File "/home/user_name/.local/share/uv/python/cpython-3.13.6-linux-x86_64-gnu/lib/python3.13/logging/__init__.py", line 1681, in handle
self.callHandlers(record)
File "/home/user_name/.local/share/uv/python/cpython-3.13.6-linux-x86_64-gnu/lib/python3.13/logging/__init__.py", line 1737, in callHandlers
hdlr.handle(record)
File "/home/user_name/.local/share/uv/python/cpython-3.13.6-linux-x86_64-gnu/lib/python3.13/logging/__init__.py", line 1027, in handle
self.emit(record)
File "/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinx/util/logging.py", line 219, in emit
super().emit(record)
Message: 'common.css'
Arguments: ()
/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinxcontrib/test_reports/environment.py:38: RemovedInSphinx90Warning: 'sphinx.builders.html.StandaloneHTMLBuilder.css_files' is deprecated. Check CHANGES for Sphinx API modifications.
if hasattr(app.builder, "css_files"):
/home/user_name/repo_name/.venv/lib/python3.13/site-packages/sphinxcontrib/test_reports/environment.py:39: RemovedInSphinx90Warning: 'sphinx.builders.html.StandaloneHTMLBuilder.css_files' is deprecated. Check CHANGES for Sphinx API modifications.
css_files = [css.filename for css in app.builder.css_files]
I believe it could be worked around with something like this:
# Silence deprecation noise from the legacy test reports extension and adapt
# its status iterator usage for modern Sphinx releases.
try:
from sphinx.deprecation import RemovedInSphinx90Warning
except ImportError: # pragma: no cover - Sphinx < 7 compatibility
RemovedInSphinx90Warning = Warning # type: ignore[assignment]
warnings.filterwarnings(
"ignore",
category=RemovedInSphinx90Warning,
module="sphinxcontrib.test_reports.environment",
)
STATUS_ITERATOR_COLOR_POSITION = 2
try:
from sphinxcontrib.test_reports import environment as _test_reports_env
except ImportError:
_test_reports_env = None
else:
_original_status_iterator = _test_reports_env.status_iterator
def _status_iterator_adapter(*args: object, **kwargs: object) -> object:
"""Coerce legacy color callables to string names before delegating."""
args_list = list(args)
kwargs_dict = dict(kwargs)
if len(args_list) > STATUS_ITERATOR_COLOR_POSITION and callable(args_list[STATUS_ITERATOR_COLOR_POSITION]):
args_list[STATUS_ITERATOR_COLOR_POSITION] = getattr(
args_list[STATUS_ITERATOR_COLOR_POSITION],
"__name__",
"brown",
)
elif "color" in kwargs_dict and callable(kwargs_dict["color"]):
kwargs_dict["color"] = getattr(kwargs_dict["color"], "__name__", "brown")
return _original_status_iterator(*args_list, **kwargs_dict)
_test_reports_env.status_iterator = _status_iterator_adapter
This silences the errors.
Regardless, I am able to use the library, but it's pretty spammy on the output, and I wanted to understand if it's just me who sees this or whether it's something that is planned on being addressed.
When I use Python 3.13 and sphinx-test-reports 1.3.1, I see random errors when trying import the library (without using it):
I believe it could be worked around with something like this:
This silences the errors.
Regardless, I am able to use the library, but it's pretty spammy on the output, and I wanted to understand if it's just me who sees this or whether it's something that is planned on being addressed.