commit:     cad319b71be04dbcca31b448392e7e226602157d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 22 08:44:28 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Oct 22 08:49:58 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cad319b7

dev-python/vcrpy: Enabe py3.12, fix tests

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

 dev-python/vcrpy/files/vcrpy-5.1.0-py312.patch | 35 ++++++++++++++++++++++++++
 dev-python/vcrpy/vcrpy-5.1.0.ebuild            | 10 +++++++-
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/dev-python/vcrpy/files/vcrpy-5.1.0-py312.patch 
b/dev-python/vcrpy/files/vcrpy-5.1.0-py312.patch
new file mode 100644
index 000000000000..2dc9fdf09e88
--- /dev/null
+++ b/dev-python/vcrpy/files/vcrpy-5.1.0-py312.patch
@@ -0,0 +1,35 @@
+From 69621c67fb29dedd9ece4a7bdbf50380fbe4c5ee Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
+Date: Thu, 3 Aug 2023 06:51:45 +0200
+Subject: [PATCH] Copy `debuglevel` and `_http_vsn` attrs into response classes
+
+Copy the `debuglevel` and `_http_vsn` attributes from base connection
+class into response classes, in order to fix compatibility with
+Python 3.12.  For reasons I don't comprehend, these end up being called
+on the class rather than instance, so regular proxying logic does not
+work.
+
+Fixes #707
+---
+ vcr/stubs/__init__.py | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/vcr/stubs/__init__.py b/vcr/stubs/__init__.py
+index dafaec71..4d4bb39d 100644
+--- a/vcr/stubs/__init__.py
++++ b/vcr/stubs/__init__.py
+@@ -389,6 +389,8 @@ class VCRHTTPConnection(VCRConnection):
+ 
+     _baseclass = HTTPConnection
+     _protocol = "http"
++    debuglevel = _baseclass.debuglevel
++    _http_vsn = _baseclass._http_vsn
+ 
+ 
+ class VCRHTTPSConnection(VCRConnection):
+@@ -397,3 +399,5 @@ class VCRHTTPSConnection(VCRConnection):
+     _baseclass = HTTPSConnection
+     _protocol = "https"
+     is_verified = True
++    debuglevel = _baseclass.debuglevel
++    _http_vsn = _baseclass._http_vsn

diff --git a/dev-python/vcrpy/vcrpy-5.1.0.ebuild 
b/dev-python/vcrpy/vcrpy-5.1.0.ebuild
index daa52ed9d3d6..0cc7495e8266 100644
--- a/dev-python/vcrpy/vcrpy-5.1.0.ebuild
+++ b/dev-python/vcrpy/vcrpy-5.1.0.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{10..11} )
+PYTHON_COMPAT=( python3_{10..12} )
 
 inherit distutils-r1
 
@@ -36,6 +36,10 @@ BDEPEND="
        )
 "
 
+PATCHES=(
+       "${FILESDIR}/${P}-py312.patch"
+)
+
 distutils_enable_tests pytest
 
 python_test() {
@@ -52,6 +56,10 @@ python_test() {
                # broken by simplejson, doesn't seem important
                # https://github.com/kevin1024/vcrpy/issues/751
                tests/unit/test_serialize.py::test_serialize_binary_request
+               # new httpbin, sigh
+               # https://github.com/kevin1024/vcrpy/issues/761
+               tests/integration/test_basic.py::test_basic_json_use
+               
tests/integration/test_register_persister.py::test_load_cassette_with_custom_persister
        )
 
        local -x REQUESTS_CA_BUNDLE=$("${EPYTHON}" -m pytest_httpbin.certs)

Reply via email to