mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
dev-python/requests-cache: Remove old
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
@@ -1,3 +1 @@
|
||||
DIST requests-cache-1.2.1.gh.tar.gz 3056882 BLAKE2B e1e5f971490f865ac2771d1dd87802ba138940adbfa0183ed5978b92794795fb26a30219de5560a925642ca08de1b8854d759408f86b30e6150e1c948ec8dcfe SHA512 f8977b1afc005ddd73019d2a0e39da368f376602110602c0b24c317b548f31a3489e686502ecd48ae3583e471fdd70671913e529c73dacdcaecadb1cd1e6c126
|
||||
DIST requests-cache-1.3.0.gh.tar.gz 1809796 BLAKE2B 11dad515569f74bfad109701a9dc7d403c01794343a3c1f05820680b1aa2e1d9d8bde3fa53df2ed1a2285b15513a0b04bdfbda7316b9cb06f7d65a84ce98ed2e SHA512 81b6f67b3fec8e062ecd419187a635898357bbb6657f3a8f162e19d634d942ed3d53835867df077089a8fb69da7951f2f400c5ac43dc51a9f857b930681711db
|
||||
DIST requests-cache-1.3.1.gh.tar.gz 1812337 BLAKE2B 302d9c6f1287901b189c74392ba0af063bf0e0ed424b85575e1cd98405f0e51225cf43f4b745d1aa89fd892721e6d2722796d77ae52bec684cee546679afb15b SHA512 68561a4b004ad99d69062a0237272ea772694df971facb5ab28388e36695e2307d21bc0eb70ef094acefaeafc586fb19151e7e3cb16deeff724e21bb035139d6
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
From a0069d9c57337c0815d9767cf6352282066baf3f Mon Sep 17 00:00:00 2001
|
||||
From: Jordan Cook <jordan.cook.git@proton.me>
|
||||
Date: Thu, 4 Sep 2025 17:56:02 -0500
|
||||
Subject: [PATCH] Replace timeout-decorator with threading-based version for
|
||||
compatibility with python 3.14 and xdist
|
||||
|
||||
multiprocessing-based timeout now raises `PicklingError` on python 3.14
|
||||
|
||||
diff --git a/tests/conftest.py b/tests/conftest.py
|
||||
index ecbf2b1a..aeff1e16 100644
|
||||
--- a/tests/conftest.py
|
||||
+++ b/tests/conftest.py
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
import os
|
||||
import platform
|
||||
+import threading
|
||||
import warnings
|
||||
from contextlib import contextmanager, nullcontext
|
||||
from datetime import datetime, timedelta, timezone
|
||||
@@ -27,7 +28,6 @@
|
||||
from requests_mock import ANY as ANY_METHOD
|
||||
from requests_mock import Adapter
|
||||
from rich.logging import RichHandler
|
||||
-from timeout_decorator import timeout
|
||||
|
||||
from requests_cache import ALL_METHODS, CachedSession, install_cache, uninstall_cache, utcnow
|
||||
|
||||
@@ -294,6 +294,40 @@ def assert_delta_approx_equal(dt1: datetime, dt2: datetime, target_delta, thresh
|
||||
assert abs(diff_in_seconds - target_delta) <= threshold_seconds
|
||||
|
||||
|
||||
+def timeout(timeout_seconds: float):
|
||||
+ """Timeout decorator that uses threading instead of multiprocessing, for compatibility with
|
||||
+ pytest-xdist on python 3.14+.
|
||||
+ """
|
||||
+
|
||||
+ def decorator(func):
|
||||
+ @wraps(func)
|
||||
+ def wrapper(*args, **kwargs):
|
||||
+ result = None
|
||||
+ exception = None
|
||||
+
|
||||
+ def target() -> None:
|
||||
+ nonlocal result, exception
|
||||
+ try:
|
||||
+ result = func(*args, **kwargs)
|
||||
+ except Exception as e:
|
||||
+ exception = e
|
||||
+
|
||||
+ thread = threading.Thread(target=target)
|
||||
+ thread.daemon = True
|
||||
+ thread.start()
|
||||
+ thread.join(timeout=timeout_seconds)
|
||||
+
|
||||
+ if thread.is_alive():
|
||||
+ raise TimeoutError(f'Function timed out after {timeout_seconds} seconds')
|
||||
+ if exception is not None:
|
||||
+ raise exception
|
||||
+ return result
|
||||
+
|
||||
+ return wrapper
|
||||
+
|
||||
+ return decorator
|
||||
+
|
||||
+
|
||||
def fail_if_no_connection(connect_timeout: float = 1.0) -> bool:
|
||||
"""Decorator for testing a backend connection. This will intentionally cause a test failure if
|
||||
the wrapped function doesn't have dependencies installed, doesn't connect after a short timeout,
|
||||
@@ -307,7 +341,7 @@ def decorator(func):
|
||||
@wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
try:
|
||||
- timeout(connect_timeout, use_signals=False)(func)(*args, **kwargs)
|
||||
+ timeout(connect_timeout)(func)(*args, **kwargs)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
pytest.fail('Could not connect to backend')
|
||||
diff --git a/tests/integration/test_mongodb.py b/tests/integration/test_mongodb.py
|
||||
index 39f6dfef..d8ac5304 100644
|
||||
--- a/tests/integration/test_mongodb.py
|
||||
+++ b/tests/integration/test_mongodb.py
|
||||
@@ -27,7 +27,10 @@ def ensure_connection():
|
||||
from pymongo import MongoClient
|
||||
|
||||
client = MongoClient(serverSelectionTimeoutMS=2000)
|
||||
- client.server_info()
|
||||
+ try:
|
||||
+ client.server_info()
|
||||
+ finally:
|
||||
+ client.close()
|
||||
|
||||
|
||||
class TestMongoDict(BaseStorageTest):
|
||||
diff --git a/tests/integration/test_redis.py b/tests/integration/test_redis.py
|
||||
index 2a34899d..a850096d 100644
|
||||
--- a/tests/integration/test_redis.py
|
||||
+++ b/tests/integration/test_redis.py
|
||||
@@ -15,7 +15,11 @@ def ensure_connection():
|
||||
"""Fail all tests in this module if Redis is not running"""
|
||||
from redis import Redis
|
||||
|
||||
- Redis().info()
|
||||
+ client = Redis()
|
||||
+ try:
|
||||
+ client.info()
|
||||
+ finally:
|
||||
+ client.close()
|
||||
|
||||
|
||||
class TestRedisDict(BaseStorageTest):
|
||||
@@ -1,95 +0,0 @@
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
DISTUTILS_USE_PEP517=poetry
|
||||
PYTHON_COMPAT=( pypy3_11 python3_{11..13} )
|
||||
PYTHON_REQ_USE="sqlite"
|
||||
|
||||
inherit distutils-r1 optfeature
|
||||
|
||||
DESCRIPTION="Persistent cache for requests library"
|
||||
HOMEPAGE="
|
||||
https://pypi.org/project/requests-cache/
|
||||
https://github.com/requests-cache/requests-cache/
|
||||
"
|
||||
SRC_URI="
|
||||
https://github.com/requests-cache/requests-cache/archive/v${PV}.tar.gz
|
||||
-> ${P}.gh.tar.gz
|
||||
"
|
||||
|
||||
LICENSE="BSD"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 arm arm64 ~loong ppc64 ~riscv x86"
|
||||
|
||||
RDEPEND="
|
||||
dev-python/attrs[${PYTHON_USEDEP}]
|
||||
>=dev-python/cattrs-22.2[${PYTHON_USEDEP}]
|
||||
>=dev-python/platformdirs-2.5[${PYTHON_USEDEP}]
|
||||
>=dev-python/requests-2.0.0[${PYTHON_USEDEP}]
|
||||
dev-python/urllib3[${PYTHON_USEDEP}]
|
||||
>=dev-python/url-normalize-1.4[${PYTHON_USEDEP}]
|
||||
"
|
||||
BDEPEND="
|
||||
test? (
|
||||
dev-python/itsdangerous[${PYTHON_USEDEP}]
|
||||
dev-python/responses[${PYTHON_USEDEP}]
|
||||
>=dev-python/rich-10.0[${PYTHON_USEDEP}]
|
||||
>=dev-python/ujson-5.4[${PYTHON_USEDEP}]
|
||||
$(python_gen_cond_dep '
|
||||
dev-python/time-machine[${PYTHON_USEDEP}]
|
||||
' 'python*')
|
||||
)
|
||||
"
|
||||
|
||||
EPYTEST_PLUGINS=( pytest-httpbin requests-mock )
|
||||
distutils_enable_tests pytest
|
||||
|
||||
PATCHES=(
|
||||
# https://github.com/requests-cache/requests-cache/pull/1111
|
||||
"${FILESDIR}/${P}-no-timeout-decorator.patch"
|
||||
)
|
||||
|
||||
python_test() {
|
||||
local EPYTEST_IGNORE=(
|
||||
# These require extra servers running
|
||||
tests/integration/test_dynamodb.py
|
||||
tests/integration/test_gridfs.py
|
||||
tests/integration/test_mongodb.py
|
||||
tests/integration/test_redis.py
|
||||
)
|
||||
local EPYTEST_DESELECT=(
|
||||
# Requires Internet access
|
||||
tests/integration/test_upgrade.py::test_version_upgrade
|
||||
)
|
||||
|
||||
case ${EPYTHON} in
|
||||
pypy3*)
|
||||
EPYTEST_DESELECT+=(
|
||||
# "database is locked", upstream probably relies on GC
|
||||
# too much
|
||||
tests/integration/test_sqlite.py
|
||||
)
|
||||
;;
|
||||
python3.12)
|
||||
# https://github.com/requests-cache/requests-cache/issues/845
|
||||
EPYTEST_DESELECT+=(
|
||||
tests/integration/test_memory.py::TestMemoryCache::test_response_no_duplicate_read
|
||||
tests/integration/test_sqlite.py::TestSQLiteCache::test_concurrency
|
||||
)
|
||||
;;
|
||||
esac
|
||||
|
||||
local -x USE_PYTEST_HTTPBIN=true
|
||||
epytest
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
optfeature "redis backend" "dev-python/redis"
|
||||
optfeature "MongoDB backend" "dev-python/pymongo"
|
||||
|
||||
optfeature "JSON serialization" "dev-python/ujson"
|
||||
optfeature "YAML serialization" "dev-python/pyyaml"
|
||||
optfeature "signing serialized data" "dev-python/itsdangerous"
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
# Copyright 1999-2026 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
DISTUTILS_USE_PEP517=hatchling
|
||||
# TODO: see if we can remove pypy3.11, because of the segfaults
|
||||
PYTHON_COMPAT=( pypy3_11 python3_{11..14} )
|
||||
PYTHON_REQ_USE="sqlite"
|
||||
|
||||
inherit distutils-r1 optfeature
|
||||
|
||||
DESCRIPTION="Persistent cache for requests library"
|
||||
HOMEPAGE="
|
||||
https://pypi.org/project/requests-cache/
|
||||
https://github.com/requests-cache/requests-cache/
|
||||
"
|
||||
SRC_URI="
|
||||
https://github.com/requests-cache/requests-cache/archive/v${PV}.tar.gz
|
||||
-> ${P}.gh.tar.gz
|
||||
"
|
||||
|
||||
LICENSE="BSD"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86"
|
||||
|
||||
RDEPEND="
|
||||
>=dev-python/attrs-21.2[${PYTHON_USEDEP}]
|
||||
>=dev-python/cattrs-22.2[${PYTHON_USEDEP}]
|
||||
>=dev-python/platformdirs-2.5[${PYTHON_USEDEP}]
|
||||
>=dev-python/requests-2.22[${PYTHON_USEDEP}]
|
||||
>=dev-python/urllib3-1.25.5[${PYTHON_USEDEP}]
|
||||
>=dev-python/url-normalize-2.0[${PYTHON_USEDEP}]
|
||||
"
|
||||
BDEPEND="
|
||||
test? (
|
||||
dev-python/itsdangerous[${PYTHON_USEDEP}]
|
||||
dev-python/responses[${PYTHON_USEDEP}]
|
||||
>=dev-python/rich-10.0[${PYTHON_USEDEP}]
|
||||
>=dev-python/ujson-5.4[${PYTHON_USEDEP}]
|
||||
$(python_gen_cond_dep '
|
||||
dev-python/time-machine[${PYTHON_USEDEP}]
|
||||
' 'python*')
|
||||
)
|
||||
"
|
||||
|
||||
EPYTEST_PLUGINS=( pytest-httpbin requests-mock )
|
||||
: ${EPYTEST_TIMEOUT:=60}
|
||||
distutils_enable_tests pytest
|
||||
|
||||
python_test() {
|
||||
local EPYTEST_IGNORE=(
|
||||
# These require extra servers running
|
||||
tests/integration/test_dynamodb.py
|
||||
tests/integration/test_gridfs.py
|
||||
tests/integration/test_mongodb.py
|
||||
tests/integration/test_redis.py
|
||||
)
|
||||
local EPYTEST_DESELECT=(
|
||||
# Requires Internet access
|
||||
tests/integration/test_upgrade.py::test_version_upgrade
|
||||
)
|
||||
|
||||
case ${EPYTHON} in
|
||||
pypy3*)
|
||||
EPYTEST_DESELECT+=(
|
||||
# "database is locked", upstream probably relies on GC
|
||||
# too much
|
||||
tests/integration/test_sqlite.py
|
||||
# random segfaults
|
||||
tests/integration/test_filesystem.py
|
||||
)
|
||||
;;
|
||||
esac
|
||||
|
||||
local -x USE_PYTEST_HTTPBIN=true
|
||||
epytest
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
optfeature "redis backend" "dev-python/redis"
|
||||
optfeature "MongoDB backend" "dev-python/pymongo"
|
||||
|
||||
optfeature "JSON serialization" "dev-python/ujson"
|
||||
optfeature "YAML serialization" "dev-python/pyyaml"
|
||||
optfeature "signing serialized data" "dev-python/itsdangerous"
|
||||
}
|
||||
Reference in New Issue
Block a user