Accepting request 993541 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/993541
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-responses?expand=0&rev=23
This commit is contained in:
Dominique Leuenberger 2022-08-10 15:12:23 +00:00 committed by Git OBS Bridge
commit 50da181f01
3 changed files with 80 additions and 2 deletions

70
py_old_re_Pattern.patch Normal file
View File

@ -0,0 +1,70 @@
---
responses/__init__.py | 23 ++++++++++++-----------
responses/tests/test_responses.py | 3 +++
2 files changed, 15 insertions(+), 11 deletions(-)
--- a/responses/__init__.py
+++ b/responses/__init__.py
@@ -7,7 +7,6 @@ from collections.abc import Sized
from functools import wraps
from http import client
from itertools import groupby
-from re import Pattern
from threading import Lock as _ThreadingLock
from typing import TYPE_CHECKING
from typing import Any
@@ -34,9 +33,11 @@ from responses.matchers import urlencode
from responses.registries import FirstMatchRegistry
try:
- from typing_extensions import Literal
-except ImportError: # pragma: no cover
- from typing import Literal # type: ignore # pragma: no cover
+ from re import Pattern
+except ImportError:
+ from re import compile
+ Pattern = type(compile(''))
+ del compile
try:
from requests.packages.urllib3.response import HTTPResponse
@@ -623,13 +624,13 @@ class OriginalResponseShim(object):
class RequestsMock(object):
- DELETE: Literal["DELETE"] = "DELETE"
- GET: Literal["GET"] = "GET"
- HEAD: Literal["HEAD"] = "HEAD"
- OPTIONS: Literal["OPTIONS"] = "OPTIONS"
- PATCH: Literal["PATCH"] = "PATCH"
- POST: Literal["POST"] = "POST"
- PUT: Literal["PUT"] = "PUT"
+ DELETE: Any = "DELETE"
+ GET: Any = "GET"
+ HEAD: Any = "HEAD"
+ OPTIONS: Any = "OPTIONS"
+ PATCH: Any = "PATCH"
+ POST: Any = "POST"
+ PUT: Any = "PUT"
response_callback: Optional[Callable[[Any], Any]] = None
--- a/responses/tests/test_responses.py
+++ b/responses/tests/test_responses.py
@@ -3,6 +3,7 @@
import inspect
import os
import re
+import sys
import warnings
from io import BufferedReader
from io import BytesIO
@@ -562,6 +563,8 @@ def test_callback():
assert_reset()
+@pytest.mark.skipif(sys.version_info[:2] <= (3, 6),
+ reason="test doesn't work on Python 3.6")
def test_deprecated_package_attributes():
"""Validates that deprecation warning is raised when package attributes are called."""
# keep separate context manager to avoid leakage

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Sat Aug 6 12:18:21 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Add py_old_re_Pattern.patch to make package buildable even on
SLE-15-SP3.
-------------------------------------------------------------------
Mon Jun 20 09:12:27 UTC 2022 - Dirk Müller <dmueller@suse.com>

View File

@ -18,7 +18,6 @@
%{?!python_module:%define python_module() python3-%{**}}
%global skip_python2 1
%global skip_python36 1
Name: python-responses
Version: 0.21.0
Release: 0
@ -27,6 +26,9 @@ License: Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/getsentry/responses
Source: https://files.pythonhosted.org/packages/source/r/responses/responses-%{version}.tar.gz
# PATCH-FIX-SLE py_old_re_Pattern.patch mcepl@suse.com
# Make package compatible with SLE-15
Patch0: py_old_re_Pattern.patch
# test requirements
BuildRequires: %{python_module cookies}
BuildRequires: %{python_module pytest-localserver}
@ -48,7 +50,7 @@ Check https://github.com/getsentry/responses for more information
about the library.
%prep
%setup -q -n responses-%{version}
%autosetup -p1 -n responses-%{version}
%build
export LANG="en_US.UTF8"