diff --git a/dev-python/coverage/coverage-7.6.12.ebuild b/dev-python/coverage/coverage-7.6.12.ebuild index bba747e1e72af..545309399cc89 100644 --- a/dev-python/coverage/coverage-7.6.12.ebuild +++ b/dev-python/coverage/coverage-7.6.12.ebuild @@ -5,7 +5,7 @@ EAPI=8 DISTUTILS_EXT=1 DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{10..13} pypy3 ) +PYTHON_COMPAT=( python3_{10..13} pypy3 pypy3_11 ) PYTHON_REQ_USE="threads(+),sqlite(+)" inherit distutils-r1 pypi @@ -39,8 +39,14 @@ BDEPEND=" distutils_enable_tests pytest src_prepare() { - sed -i -e '/addopts/s:-q -n auto::' pyproject.toml || die + local PATCHES=( + # https://github.com/nedbat/coveragepy/pull/1929 + "${FILESDIR}/${P}-pypy311.patch" + ) + distutils-r1_src_prepare + + sed -i -e '/addopts/s:-q -n auto::' pyproject.toml || die } python_compile() { @@ -97,7 +103,7 @@ python_test() { test_tracer pytrace case ${EPYTHON} in - python3.1[01]|pypy3) + python3.1[01]|pypy3|pypy3.11) ;; *) # available since Python 3.12 diff --git a/dev-python/coverage/files/coverage-7.6.12-pypy311.patch b/dev-python/coverage/files/coverage-7.6.12-pypy311.patch new file mode 100644 index 0000000000000..62fa908d8ca92 --- /dev/null +++ b/dev-python/coverage/files/coverage-7.6.12-pypy311.patch @@ -0,0 +1,25 @@ +From 059be065e28551d4b029c8d525fafdaea3df4a3d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Tue, 18 Feb 2025 11:10:21 +0100 +Subject: [PATCH 1/2] test: Fix expected exception message for PyPy3.11 + +Fix the regex in `test_parser.py::PythonParserTest::test_not_python` +to account for the possibility of code being wrapped in double quotes +rather than single quotes, to fix the test on PyPy3.11. +--- + tests/test_parser.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/test_parser.py b/tests/test_parser.py +index 2ab30853..a9a247ff 100644 +--- a/tests/test_parser.py ++++ b/tests/test_parser.py +@@ -123,7 +123,7 @@ class PythonParserTest(PythonParserTestBase): + ) + ]) + def test_not_python(self, text: str) -> None: +- msg = r"Couldn't parse '' as Python source: '.*' at line \d+" ++ msg = r"Couldn't parse '' as Python source: ['\"].*['\"] at line \d+" + with pytest.raises(NotPython, match=msg): + _ = self.parse_text(text) +