public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/coverage/files/, dev-python/coverage/
@ 2019-11-16  7:57 Patrick McLean
  0 siblings, 0 replies; 3+ messages in thread
From: Patrick McLean @ 2019-11-16  7:57 UTC (permalink / raw
  To: gentoo-commits

commit:     8b121a58741c04aea2468260ca1c1bb1b815740e
Author:     Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 16 07:57:33 2019 +0000
Commit:     Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Sat Nov 16 07:57:33 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8b121a58

dev-python/coverage: Fix tests with cpython in 4.5.4

Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>

 dev-python/coverage/coverage-4.5.4.ebuild          |  26 +++++-
 .../coverage/files/coverage-4.5.4-tests.patch      | 104 +++++++++++++++++++++
 2 files changed, 126 insertions(+), 4 deletions(-)

diff --git a/dev-python/coverage/coverage-4.5.4.ebuild b/dev-python/coverage/coverage-4.5.4.ebuild
index f6b95bdeabd..75ac87bd7a1 100644
--- a/dev-python/coverage/coverage-4.5.4.ebuild
+++ b/dev-python/coverage/coverage-4.5.4.ebuild
@@ -28,9 +28,15 @@ BDEPEND="
 	)
 "
 
+DISTUTILS_IN_SOURCE_BUILD=1
+
+PATCHES=(
+	"${FILESDIR}/coverage-4.5.4-tests.patch"
+)
+
 src_prepare() {
-	# avoid the dep on xdist
-	sed -i -e '/^addopts/s:-n3::' setup.cfg || die
+	# avoid the dep on xdist, run tests verbosely
+	sed -i -e '/^addopts/s:-n3:-v:' setup.cfg || die
 	distutils-r1_src_prepare
 }
 
@@ -45,6 +51,18 @@ python_compile() {
 
 python_test() {
 	distutils_install_for_testing
-	"${EPYTHON}" igor.py test_with_tracer py || die
-	"${EPYTHON}" igor.py test_with_tracer c || die
+	local bindir=${TEST_DIR}/scripts
+
+	pushd tests/eggsrc >/dev/null || die
+	distutils_install_for_testing
+	popd >/dev/null || die
+
+	"${EPYTHON}" igor.py zip_mods || die
+	PATH="${bindir}:${PATH}" "${EPYTHON}" igor.py test_with_tracer py || die
+
+	# No C extensions under pypy
+	if [[ ${EPYTHON} != pypy* ]]; then
+		cp -l -- "${TEST_DIR}"/lib/*/coverage/*.so coverage/ || die
+		PATH="${bindir}:${PATH}" "${EPYTHON}" igor.py test_with_tracer c || die
+	fi
 }

diff --git a/dev-python/coverage/files/coverage-4.5.4-tests.patch b/dev-python/coverage/files/coverage-4.5.4-tests.patch
new file mode 100644
index 00000000000..193c4e88ef9
--- /dev/null
+++ b/dev-python/coverage/files/coverage-4.5.4-tests.patch
@@ -0,0 +1,104 @@
+diff --git a/tests/farm/run/run_timid.py b/tests/farm/run/run_timid.py
+index 0370cf84..4e3cf1ca 100644
+--- a/tests/farm/run/run_timid.py
++++ b/tests/farm/run/run_timid.py
+@@ -38,6 +38,10 @@ if os.environ.get('COVERAGE_TEST_TRACER', 'c') == 'c':
+ else:
+     # If the Python trace function is being tested, then regular running will
+     # also show the Python function.
+-    contains("out_timid/showtraceout.txt", "regular PyTracer")
++    #
++    # tox.ini deletes compiled c modules to make this test work, not feasible
++    # to do this from the ebuild environment
++    #contains("out_timid/showtraceout.txt", "regular PyTracer")
++    pass
+ 
+ clean("out_timid")
+diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py
+index 578cc679..ae340099 100644
+--- a/tests/test_concurrency.py
++++ b/tests/test_concurrency.py
+@@ -11,6 +11,7 @@ import time
+ 
+ from flaky import flaky
+ 
++import unittest
+ import coverage
+ from coverage import env
+ from coverage.backward import import_local_file
+@@ -271,6 +272,7 @@ class ConcurrencyTest(CoverageTest):
+         code = SIMPLE.format(QLIMIT=self.QLIMIT)
+         self.try_some_code(code, "gevent", gevent)
+ 
++    @unittest.skip("greenlet tests don't work with python tracer")
+     def test_greenlet(self):
+         GREENLET = """\
+             from greenlet import greenlet
+@@ -289,6 +291,7 @@ class ConcurrencyTest(CoverageTest):
+             """
+         self.try_some_code(GREENLET, "greenlet", greenlet, "hello world\n42\n")
+ 
++    @unittest.skip("greenlet tests don't work with python tracer")
+     def test_greenlet_simple_code(self):
+         code = SIMPLE.format(QLIMIT=self.QLIMIT)
+         self.try_some_code(code, "greenlet", greenlet)
+diff --git a/tests/test_filereporter.py b/tests/test_filereporter.py
+index 91e47762..121c3260 100644
+--- a/tests/test_filereporter.py
++++ b/tests/test_filereporter.py
+@@ -4,6 +4,7 @@
+ """Tests for FileReporters"""
+ 
+ import os
++import unittest
+ 
+ from coverage.plugin import FileReporter
+ from coverage.python import PythonFileReporter
+@@ -87,6 +88,7 @@ class FileReporterTest(UsingModulesMixin, CoverageTest):
+         assert acu < bcu and acu <= bcu and acu != bcu
+         assert bcu > acu and bcu >= acu and bcu != acu
+ 
++    @unittest.skip("we don't install zip eggs on gentoo")
+     def test_egg(self):
+         # Test that we can get files out of eggs, and read their source files.
+         # The egg1 module is installed by an action in igor.py.
+diff --git a/tests/test_oddball.py b/tests/test_oddball.py
+index aa2f333c..bc63395a 100644
+--- a/tests/test_oddball.py
++++ b/tests/test_oddball.py
+@@ -405,7 +405,9 @@ class DoctestTest(CoverageTest):
+         # well with coverage. Nose fixes the problem by monkeypatching doctest.
+         # I want to be sure there's no monkeypatch and that I'm getting the
+         # doctest module that users of coverage will get.
+-        assert 'doctest' not in sys.modules
++
++        # gentoo is not running these tests via nose, so there is no monkeypatching
++        #assert 'doctest' not in sys.modules
+ 
+     def test_doctest(self):
+         self.check_coverage('''\
+diff --git a/tests/test_process.py b/tests/test_process.py
+index 62dc80a5..7fa9b2ba 100644
+--- a/tests/test_process.py
++++ b/tests/test_process.py
+@@ -620,11 +620,16 @@ class ProcessTest(CoverageTest):
+             print("FOOEY == %s" % os.getenv("FOOEY"))
+             """)
+ 
+-        fullcov = os.path.join(
+-            os.path.dirname(coverage.__file__), "fullcoverage"
+-            )
++        # we want to use the coverage module we are testing, not the system installation
++        paths = [
++            os.path.join(
++                os.path.dirname(coverage.__file__), "fullcoverage"
++            ),
++            os.path.dirname(os.path.dirname(coverage.__file__))
++        ]
+         self.set_environ("FOOEY", "BOO")
+-        self.set_environ("PYTHONPATH", fullcov)
++        self.set_environ("PYTHONPATH", ':'.join(paths))
++        print(paths)
+         out = self.run_command("python -m coverage run -L getenv.py")
+         self.assertEqual(out, "FOOEY == BOO\n")
+         data = coverage.CoverageData()


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/coverage/files/, dev-python/coverage/
@ 2020-09-20  7:57 Michał Górny
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2020-09-20  7:57 UTC (permalink / raw
  To: gentoo-commits

commit:     dcc347211a5d6ef68938d8a4d5eefdc10b2d600c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 20 07:47:49 2020 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 07:56:48 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dcc34721

dev-python/coverage: Kill tests in <5 to unblock deps

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/coverage/coverage-4.5.4.ebuild          |  46 +-------
 .../coverage/files/coverage-4.5.4-tests.patch      | 124 ---------------------
 2 files changed, 1 insertion(+), 169 deletions(-)

diff --git a/dev-python/coverage/coverage-4.5.4.ebuild b/dev-python/coverage/coverage-4.5.4.ebuild
index 5da1dac252e..0f9a10796d3 100644
--- a/dev-python/coverage/coverage-4.5.4.ebuild
+++ b/dev-python/coverage/coverage-4.5.4.ebuild
@@ -14,33 +14,10 @@ SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
 LICENSE="BSD"
 SLOT="0"
 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~s390 sparc x86"
-IUSE="test"
-RESTRICT="!test? ( test )"
-
-RDEPEND=""
-BDEPEND="
-	>=dev-python/setuptools-18.4[${PYTHON_USEDEP}]
-	test? (
-		dev-python/PyContracts[${PYTHON_USEDEP}]
-		dev-python/flaky[${PYTHON_USEDEP}]
-		dev-python/mock[${PYTHON_USEDEP}]
-		dev-python/pytest[${PYTHON_USEDEP}]
-		>=dev-python/unittest-mixins-1.4[${PYTHON_USEDEP}]
-	)
-"
+RESTRICT="test"
 
 DISTUTILS_IN_SOURCE_BUILD=1
 
-PATCHES=(
-	"${FILESDIR}/coverage-4.5.4-tests.patch"
-)
-
-src_prepare() {
-	# avoid the dep on xdist, run tests verbosely
-	sed -i -e '/^addopts/s:-n3:-v:' setup.cfg || die
-	distutils-r1_src_prepare
-}
-
 python_compile() {
 	if [[ ${EPYTHON} == python2.7 ]]; then
 		local CFLAGS="${CFLAGS} -fno-strict-aliasing"
@@ -49,24 +26,3 @@ python_compile() {
 
 	distutils-r1_python_compile
 }
-
-python_test() {
-	distutils_install_for_testing
-	local bindir=${TEST_DIR}/scripts
-
-	pushd tests/eggsrc >/dev/null || die
-	distutils_install_for_testing
-	popd >/dev/null || die
-
-	"${EPYTHON}" igor.py zip_mods || die
-	PATH="${bindir}:${PATH}" "${EPYTHON}" igor.py test_with_tracer py || die
-
-	# No C extensions under pypy
-	if [[ ${EPYTHON} != pypy* ]]; then
-		cp -l -- "${TEST_DIR}"/lib/*/coverage/*.so coverage/ || die
-		PATH="${bindir}:${PATH}" "${EPYTHON}" igor.py test_with_tracer c || die
-	fi
-
-	# clean up leftover "egg1" directory
-	rm -rf build/lib/egg1 || die
-}

diff --git a/dev-python/coverage/files/coverage-4.5.4-tests.patch b/dev-python/coverage/files/coverage-4.5.4-tests.patch
deleted file mode 100644
index 779102c8f65..00000000000
--- a/dev-python/coverage/files/coverage-4.5.4-tests.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-diff --git a/tests/farm/run/run_timid.py b/tests/farm/run/run_timid.py
-index 0370cf84..4e3cf1ca 100644
---- a/tests/farm/run/run_timid.py
-+++ b/tests/farm/run/run_timid.py
-@@ -38,6 +38,10 @@ if os.environ.get('COVERAGE_TEST_TRACER', 'c') == 'c':
- else:
-     # If the Python trace function is being tested, then regular running will
-     # also show the Python function.
--    contains("out_timid/showtraceout.txt", "regular PyTracer")
-+    #
-+    # tox.ini deletes compiled c modules to make this test work, not feasible
-+    # to do this from the ebuild environment
-+    #contains("out_timid/showtraceout.txt", "regular PyTracer")
-+    pass
- 
- clean("out_timid")
-diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py
-index 578cc679..c875be86 100644
---- a/tests/test_concurrency.py
-+++ b/tests/test_concurrency.py
-@@ -11,6 +11,7 @@ import time
- 
- from flaky import flaky
- 
-+import unittest
- import coverage
- from coverage import env
- from coverage.backward import import_local_file
-@@ -255,22 +256,27 @@ class ConcurrencyTest(CoverageTest):
-         code = SIMPLE.format(QLIMIT=self.QLIMIT)
-         self.try_some_code(code, "thread", threading)
- 
-+    @unittest.skipIf(env.PY2, "eventlet tests don't work with python tracer on python2")
-     def test_eventlet(self):
-         code = (EVENTLET + SUM_RANGE_Q + PRINT_SUM_RANGE).format(QLIMIT=self.QLIMIT)
-         self.try_some_code(code, "eventlet", eventlet)
- 
-+    @unittest.skipIf(env.PY2, "eventlet tests don't work with python tracer on python2")
-     def test_eventlet_simple_code(self):
-         code = SIMPLE.format(QLIMIT=self.QLIMIT)
-         self.try_some_code(code, "eventlet", eventlet)
- 
-+    @unittest.skipIf(env.PY2, "gevent tests don't work with python tracer on python2")
-     def test_gevent(self):
-         code = (GEVENT + SUM_RANGE_Q + PRINT_SUM_RANGE).format(QLIMIT=self.QLIMIT)
-         self.try_some_code(code, "gevent", gevent)
- 
-+    @unittest.skipIf(env.PY2, "gevent tests don't work with python tracer on python2")
-     def test_gevent_simple_code(self):
-         code = SIMPLE.format(QLIMIT=self.QLIMIT)
-         self.try_some_code(code, "gevent", gevent)
- 
-+    @unittest.skip("greenlet tests don't work with python tracer")
-     def test_greenlet(self):
-         GREENLET = """\
-             from greenlet import greenlet
-@@ -289,6 +295,7 @@ class ConcurrencyTest(CoverageTest):
-             """
-         self.try_some_code(GREENLET, "greenlet", greenlet, "hello world\n42\n")
- 
-+    @unittest.skip("greenlet tests don't work with python tracer")
-     def test_greenlet_simple_code(self):
-         code = SIMPLE.format(QLIMIT=self.QLIMIT)
-         self.try_some_code(code, "greenlet", greenlet)
-diff --git a/tests/test_filereporter.py b/tests/test_filereporter.py
-index 91e47762..121c3260 100644
---- a/tests/test_filereporter.py
-+++ b/tests/test_filereporter.py
-@@ -4,6 +4,7 @@
- """Tests for FileReporters"""
- 
- import os
-+import unittest
- 
- from coverage.plugin import FileReporter
- from coverage.python import PythonFileReporter
-@@ -87,6 +88,7 @@ class FileReporterTest(UsingModulesMixin, CoverageTest):
-         assert acu < bcu and acu <= bcu and acu != bcu
-         assert bcu > acu and bcu >= acu and bcu != acu
- 
-+    @unittest.skip("we don't install zip eggs on gentoo")
-     def test_egg(self):
-         # Test that we can get files out of eggs, and read their source files.
-         # The egg1 module is installed by an action in igor.py.
-diff --git a/tests/test_oddball.py b/tests/test_oddball.py
-index aa2f333c..bc63395a 100644
---- a/tests/test_oddball.py
-+++ b/tests/test_oddball.py
-@@ -405,7 +405,9 @@ class DoctestTest(CoverageTest):
-         # well with coverage. Nose fixes the problem by monkeypatching doctest.
-         # I want to be sure there's no monkeypatch and that I'm getting the
-         # doctest module that users of coverage will get.
--        assert 'doctest' not in sys.modules
-+
-+        # gentoo is not running these tests via nose, so there is no monkeypatching
-+        #assert 'doctest' not in sys.modules
- 
-     def test_doctest(self):
-         self.check_coverage('''\
-diff --git a/tests/test_process.py b/tests/test_process.py
-index 62dc80a5..7fa9b2ba 100644
---- a/tests/test_process.py
-+++ b/tests/test_process.py
-@@ -620,11 +620,16 @@ class ProcessTest(CoverageTest):
-             print("FOOEY == %s" % os.getenv("FOOEY"))
-             """)
- 
--        fullcov = os.path.join(
--            os.path.dirname(coverage.__file__), "fullcoverage"
--            )
-+        # we want to use the coverage module we are testing, not the system installation
-+        paths = [
-+            os.path.join(
-+                os.path.dirname(coverage.__file__), "fullcoverage"
-+            ),
-+            os.path.dirname(os.path.dirname(coverage.__file__))
-+        ]
-         self.set_environ("FOOEY", "BOO")
--        self.set_environ("PYTHONPATH", fullcov)
-+        self.set_environ("PYTHONPATH", ':'.join(paths))
-+        print(paths)
-         out = self.run_command("python -m coverage run -L getenv.py")
-         self.assertEqual(out, "FOOEY == BOO\n")
-         data = coverage.CoverageData()


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/coverage/files/, dev-python/coverage/
@ 2025-02-18 10:30 Michał Górny
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2025-02-18 10:30 UTC (permalink / raw
  To: gentoo-commits

commit:     6eee4d3dcc59a314b8f221841b9cf4f2ca059bcf
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 18 09:53:43 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Feb 18 10:21:32 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6eee4d3d

dev-python/coverage: Enable pypy3.11

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/coverage/coverage-7.6.12.ebuild         | 12 ++++++++---
 .../coverage/files/coverage-7.6.12-pypy311.patch   | 25 ++++++++++++++++++++++
 2 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/dev-python/coverage/coverage-7.6.12.ebuild b/dev-python/coverage/coverage-7.6.12.ebuild
index bba747e1e72a..545309399cc8 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 000000000000..62fa908d8ca9
--- /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?= <mgorny@gentoo.org>
+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 '<code>' as Python source: '.*' at line \d+"
++        msg = r"Couldn't parse '<code>' as Python source: ['\"].*['\"] at line \d+"
+         with pytest.raises(NotPython, match=msg):
+             _ = self.parse_text(text)
+ 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-18 10:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-20  7:57 [gentoo-commits] repo/gentoo:master commit in: dev-python/coverage/files/, dev-python/coverage/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2025-02-18 10:30 Michał Górny
2019-11-16  7:57 Patrick McLean

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox