diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b31f805b..0a504e9ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,8 @@ jobs: - "3.13" - "3.14" - "3.15" - - "pypy3.10" + - "pypy3.11" + - "pypy3.12" env: BABEL_CLDR_NO_DOWNLOAD_PROGRESS: "1" BABEL_CLDR_QUIET: "1" diff --git a/conftest.py b/conftest.py index 015a20440..4ed891ccd 100644 --- a/conftest.py +++ b/conftest.py @@ -1,6 +1,9 @@ +import os from pathlib import Path +from unittest import mock -from _pytest.doctest import DoctestModule +import pytest +from _pytest.doctest import DoctestItem, DoctestModule collect_ignore = [ 'babel/messages/setuptools_frontend.py', @@ -21,3 +24,14 @@ def _is_relative(p1: Path, p2: Path) -> bool: def pytest_collect_file(file_path: Path, parent): if _is_relative(file_path, babel_path) and file_path.suffix == '.py': return DoctestModule.from_parent(parent, path=file_path) + + +@pytest.fixture(autouse=True) +def _isolate_doctest_environ(request): + # Clean up after after doctests that modify environment + # variables (e.g. core.default_locale) + if isinstance(request.node, DoctestItem): + with mock.patch.dict(os.environ): + yield + else: + yield diff --git a/tests/messages/test_setuptools_frontend.py b/tests/messages/test_setuptools_frontend.py index d74c8e7a7..b55e8e3e8 100644 --- a/tests/messages/test_setuptools_frontend.py +++ b/tests/messages/test_setuptools_frontend.py @@ -48,13 +48,6 @@ def test_extract_distutils_keyword_arg_388(kwarg, expected): assert set(cmdinst.add_comments) == {"Bar", "Foo"} -@pytest.mark.xfail( - # Python 3.10.16[pypy-7.3.19-final] in GHA fails with "unsupported locale setting" - # in the subprocesses this test spawns. Hard to say why because it doesn't do that - # locally. - condition=(sys.implementation.name == "pypy" and "BABEL_TOX_INI_DIR" in os.environ), - reason="Test will likely fail with 'unsupported locale setting' in subprocesses; see comment", -) def test_setuptools_commands(tmp_path, monkeypatch): """ Smoke-tests all of the setuptools versions of the commands in turn.