public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/requests-mock/files/, dev-python/requests-mock/
@ 2022-05-22 14:51 Andrew Ammerlaan
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Ammerlaan @ 2022-05-22 14:51 UTC (permalink / raw
  To: gentoo-commits

commit:     3a39ea1ffa7d996190bb4ae5b2b0b14b1a045849
Author:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
AuthorDate: Sun May 22 14:38:20 2022 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Sun May 22 14:51:18 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a39ea1f

dev-python/requests-mock: fix test failure, add py3.11

Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>

 .../requests-mock-1.9.3-obj-has-no-attr-url.patch  | 50 ++++++++++++++++++++++
 .../requests-mock/requests-mock-1.9.3-r1.ebuild    | 49 +++++++++++++++++++++
 2 files changed, 99 insertions(+)

diff --git a/dev-python/requests-mock/files/requests-mock-1.9.3-obj-has-no-attr-url.patch b/dev-python/requests-mock/files/requests-mock-1.9.3-obj-has-no-attr-url.patch
new file mode 100644
index 000000000000..d43b0b41e65a
--- /dev/null
+++ b/dev-python/requests-mock/files/requests-mock-1.9.3-obj-has-no-attr-url.patch
@@ -0,0 +1,50 @@
+From 7238c1148c756e6a27c3dbc1ccbff7a3e9a60d82 Mon Sep 17 00:00:00 2001
+From: Jamie Lennox <jamielennox@gmail.com>
+Date: Fri, 28 May 2021 09:33:25 +0700
+Subject: [PATCH] Fix failing pytest
+
+When you start a method with test_ pytest loads it and tries to parse
+the parameters as fixtures. In this case it's not a real test, just a
+matcher function used later on in the test file.
+
+We can inline it into the function as it's only used in one place.
+
+Fixes: #175
+---
+ tests/test_custom_matchers.py | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/tests/test_custom_matchers.py b/tests/test_custom_matchers.py
+index d49f72a..546a63e 100644
+--- a/tests/test_custom_matchers.py
++++ b/tests/test_custom_matchers.py
+@@ -31,13 +31,6 @@ def match_all(request):
+     return requests_mock.create_response(request, content=six.b('data'))
+ 
+ 
+-def test_a(request):
+-    if 'a' in request.url:
+-        return match_all(request)
+-
+-    return None
+-
+-
+ class CustomMatchersTests(base.TestCase):
+ 
+     def assertMatchAll(self, resp):
+@@ -65,7 +58,14 @@ def test_failing_matcher(self, mocker):
+ 
+     @requests_mock.Mocker()
+     def test_some_pass(self, mocker):
+-        mocker.add_matcher(test_a)
++
++        def matcher_a(request):
++            if 'a' in request.url:
++                return match_all(request)
++
++            return None
++
++        mocker.add_matcher(matcher_a)
+ 
+         resp = requests.get('http://any/thing')
+         self.assertMatchAll(resp)

diff --git a/dev-python/requests-mock/requests-mock-1.9.3-r1.ebuild b/dev-python/requests-mock/requests-mock-1.9.3-r1.ebuild
new file mode 100644
index 000000000000..f6ab5d2b33d0
--- /dev/null
+++ b/dev-python/requests-mock/requests-mock-1.9.3-r1.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( pypy3 python3_{8..11} )
+DISTUTILS_USE_PEP517=setuptools
+inherit distutils-r1
+
+DESCRIPTION="Mock out responses from the requests package"
+HOMEPAGE="https://github.com/jamielennox/requests-mock"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="amd64 ~arm arm64 ~ppc64 ~riscv x86"
+
+RDEPEND="
+	>=dev-python/requests-2.3[${PYTHON_USEDEP}]
+	dev-python/six[${PYTHON_USEDEP}]
+"
+BDEPEND="
+	>=dev-python/pbr-0.8[${PYTHON_USEDEP}]
+	test? (
+		dev-python/fixtures[${PYTHON_USEDEP}]
+		dev-python/mock[${PYTHON_USEDEP}]
+		dev-python/pytest[${PYTHON_USEDEP}]
+		dev-python/testtools[${PYTHON_USEDEP}]
+	)
+"
+
+PATCHES=(
+	"${FILESDIR}/${P}-obj-has-no-attr-url.patch"
+)
+
+distutils_enable_sphinx doc/source
+distutils_enable_tests pytest
+
+python_prepare_all() {
+	# Disable reno which only works inside a git repository
+	sed -i "s/'reno.sphinxext',//" doc/source/conf.py || die
+	# Remove the release notes section which requires reno
+	rm doc/source/release-notes.rst || die
+	sed -i '/^=============$/,/release-notes/d' doc/source/index.rst || die
+	# Disable a test which requires purl (not in the tree)
+	sed -i -e "/^import purl$/d" -e "s/test_with_purl/_&/" \
+		tests/test_adapter.py || die
+	distutils-r1_python_prepare_all
+}


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

* [gentoo-commits] repo/gentoo:master commit in: dev-python/requests-mock/files/, dev-python/requests-mock/
@ 2024-03-28 12:26 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2024-03-28 12:26 UTC (permalink / raw
  To: gentoo-commits

commit:     95b7c715b18099de0d637d082b841b8eea4866b4
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 28 12:25:54 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Mar 28 12:26:52 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95b7c715

dev-python/requests-mock: Remove last use of pbr

Closes: https://bugs.gentoo.org/928008
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../files/requests-mock-1.12.0-no-pbr.patch        | 22 ++++++++++++++++++++++
 .../requests-mock/requests-mock-1.12.0.ebuild      |  5 +++++
 2 files changed, 27 insertions(+)

diff --git a/dev-python/requests-mock/files/requests-mock-1.12.0-no-pbr.patch b/dev-python/requests-mock/files/requests-mock-1.12.0-no-pbr.patch
new file mode 100644
index 000000000000..fcfc8f9d2eb4
--- /dev/null
+++ b/dev-python/requests-mock/files/requests-mock-1.12.0-no-pbr.patch
@@ -0,0 +1,22 @@
+From 82a6d09fa8db7a0667b365e9c06e99f8c0dfd245 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Thu, 28 Mar 2024 12:54:18 +0100
+Subject: [PATCH] Replace the last use of pbr with modern packaging
+
+diff --git a/doc/source/conf.py b/doc/source/conf.py
+index 395acaa..e0895f5 100755
+--- a/doc/source/conf.py
++++ b/doc/source/conf.py
+@@ -16 +16,2 @@ import sys, os
+-import pbr.version
++import importlib.metadata
++import packaging
+@@ -56 +57 @@ copyright = u'2023, Jamie Lennox'
+-version_info = pbr.version.VersionInfo(project)
++version_info = packaging.version.parse(importlib.metadata.version(project))
+@@ -59 +60 @@ version_info = pbr.version.VersionInfo(project)
+-version = version_info.version_string()
++version = version_info.base_version
+@@ -61 +62 @@ version = version_info.version_string()
+-release = version_info.release_string()
++release = version_info.public

diff --git a/dev-python/requests-mock/requests-mock-1.12.0.ebuild b/dev-python/requests-mock/requests-mock-1.12.0.ebuild
index a0e17f881c2f..ff7866ac1da6 100644
--- a/dev-python/requests-mock/requests-mock-1.12.0.ebuild
+++ b/dev-python/requests-mock/requests-mock-1.12.0.ebuild
@@ -36,6 +36,11 @@ distutils_enable_sphinx doc/source
 distutils_enable_tests pytest
 
 python_prepare_all() {
+	local PATCHES=(
+		# https://github.com/jamielennox/requests-mock/pull/255
+		"${FILESDIR}/${P}-no-pbr.patch"
+	)
+
 	# Disable reno which only works inside a git repository
 	sed -i "s/'reno.sphinxext',//" doc/source/conf.py || die
 	# Remove the release notes section which requires reno


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

end of thread, other threads:[~2024-03-28 12:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-28 12:26 [gentoo-commits] repo/gentoo:master commit in: dev-python/requests-mock/files/, dev-python/requests-mock/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2022-05-22 14:51 Andrew Ammerlaan

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