diff options
Diffstat (limited to 'dev-python/pytest')
-rw-r--r-- | dev-python/pytest/files/pytest-7.4.3-no-color.patch | 37 | ||||
-rw-r--r-- | dev-python/pytest/pytest-7.4.3.ebuild | 5 |
2 files changed, 42 insertions, 0 deletions
diff --git a/dev-python/pytest/files/pytest-7.4.3-no-color.patch b/dev-python/pytest/files/pytest-7.4.3-no-color.patch new file mode 100644 index 000000000000..a6fa02472252 --- /dev/null +++ b/dev-python/pytest/files/pytest-7.4.3-no-color.patch @@ -0,0 +1,37 @@ +From ce93a8ad7a11d1e9be76ce6af0d510f935622c1f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Sat, 25 Nov 2023 12:09:32 +0100 +Subject: [PATCH] Reset color-related envvars for testing + +Reset color-related environment variables in a fixture to prevent them +from affecting test results. Otherwise, some of the tests fail +e.g. if NO_COLOR is set in the calling environment. +--- + testing/conftest.py | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/testing/conftest.py b/testing/conftest.py +index 2a3ce5203..612777304 100644 +--- a/testing/conftest.py ++++ b/testing/conftest.py +@@ -30,6 +30,17 @@ def set_column_width(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setenv("COLUMNS", "80") + + ++@pytest.fixture(autouse=True) ++def reset_colors(monkeypatch: pytest.MonkeyPatch) -> None: ++ """ ++ Reset all color-related variables to prevent them from affecting internal pytest output ++ in tests that depend on it. ++ """ ++ monkeypatch.delenv("PY_COLORS", raising=False) ++ monkeypatch.delenv("NO_COLOR", raising=False) ++ monkeypatch.delenv("FORCE_COLOR", raising=False) ++ ++ + @pytest.hookimpl(hookwrapper=True, tryfirst=True) + def pytest_collection_modifyitems(items): + """Prefer faster tests. +-- +2.43.0 + diff --git a/dev-python/pytest/pytest-7.4.3.ebuild b/dev-python/pytest/pytest-7.4.3.ebuild index 34cc63f9e938..55eb8e448514 100644 --- a/dev-python/pytest/pytest-7.4.3.ebuild +++ b/dev-python/pytest/pytest-7.4.3.ebuild @@ -49,6 +49,11 @@ BDEPEND=" ) " +PATCHES=( + # https://github.com/pytest-dev/pytest/pull/11638 + "${FILESDIR}/${P}-no-color.patch" +) + src_test() { # workaround new readline defaults echo "set enable-bracketed-paste off" > "${T}"/inputrc || die |