From 3b52645bb00560805aeb81566bd4bd9b0ac25f5f Mon Sep 17 00:00:00 2001 From: harryswift01 Date: Tue, 17 Nov 2026 14:52:50 +0000 Subject: [PATCH 1/2] chore(test): replace `pytest-sugar` with `pytest-modern` --- pyproject.toml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 51c2f7f8..fdfb407a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,7 +63,7 @@ Documentation = "https://codeentropy.readthedocs.io" testing = [ "pytest>=9.0,<10.0", "pytest-cov>=7.0,<8.0", - "pytest-sugar>=1.1,<2.0", + "pytest-modern>=0.7.5,<0.8.0", ] pre-commit = [ "pre-commit>=3.5.0,<5.0", @@ -84,11 +84,16 @@ CodeEntropy = "CodeEntropy.cli:main" [tool.pytest.ini_options] testpaths = ["tests"] -addopts = "-vv -ra" +addopts = [ + "-vv", + "-ra", + "--cov", + "--cov-report=term-missing", +] markers = [ - "regression: end-to-end regression tests against baselines", - "slow: long-running regression tests (20-30+ minutes)", + "regression: end-to-end regression tests against baselines", + "slow: long-running regression tests (20-30+ minutes)", ] [tool.ruff] From c2da26f4c9589763d2b46369a7a57dde0f6a55b9 Mon Sep 17 00:00:00 2001 From: harryswift01 Date: Tue, 17 Nov 2026 15:13:17 +0000 Subject: [PATCH 2/2] fix(test): force UTF-8 terminal output for `pytest-modern` on Windows --- tests/conftest.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/conftest.py diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 00000000..46bf53c1 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,19 @@ +from __future__ import annotations + +import sys + +import pytest + + +@pytest.hookimpl(tryfirst=True) +def pytest_configure(config): + """ + Force UTF-8 output for the terminal reporter. + + On Windows CI stdout is a pipe using cp1252, and pytest-modern crashes + when it writes characters that cp1252 can't encode. This has to run + before pytest-modern sets up its console. + """ + for stream in (sys.stdout, sys.stderr): + if hasattr(stream, "reconfigure") and stream.encoding.lower() != "utf-8": + stream.reconfigure(encoding="utf-8", errors="backslashreplace")