14
0

Accepting request 1224301 from devel:languages:python

- Add xsd-date.patch to fix test failure
- Stop providing/obsoleting python-zeep, as the latter exists in OBS
  and is more up-to-date on a lower version

OBS-URL: https://build.opensuse.org/request/show/1224301
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-softlayer-zeep?expand=0&rev=5
This commit is contained in:
2024-11-15 14:43:04 +00:00
committed by Git OBS Bridge
3 changed files with 56 additions and 2 deletions

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Nov 14 12:18:00 UTC 2024 - Markéta Machová <mmachova@suse.com>
- Add xsd-date.patch to fix test failure
- Stop providing/obsoleting python-zeep, as the latter exists in OBS
and is more up-to-date on a lower version
-------------------------------------------------------------------
Tue Oct 29 05:34:42 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>

View File

@@ -28,6 +28,8 @@ Source: https://files.pythonhosted.org/packages/source/s/softlayer-zeep/
# PATCH-FIX-UPSTREAM skip-networked-test.patch gh#mvantellingen/python-zeep#1402 mcepl@suse.com
# skip tests requiring network connection
Patch0: skip-networked-test.patch
# PATCH-FIX-UPSTREAM gh#mvantellingen/python-zeep#d1b0257 Fix regression in parsing xsd:Date with negative timezone
Patch1: xsd-date.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
@@ -40,8 +42,7 @@ Requires: python-pytz
Requires: python-requests >= 2.7.0
Requires: python-requests-file >= 1.5.1
Requires: python-requests-toolbelt >= 0.7.1
Provides: python-zeep = %{version}
Obsoletes: python-zeep < %{version}
Conflicts: python-zeep
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module attrs >= 17.2.0}

46
xsd-date.patch Normal file
View File

@@ -0,0 +1,46 @@
From d1b0257eb7b8f41bc74c0fa178e820c2d739cf30 Mon Sep 17 00:00:00 2001
From: Michael van Tellingen <m.vantellingen@labdigital.nl>
Date: Wed, 16 Oct 2024 07:21:21 +0200
Subject: [PATCH] Fix regression in parsing xsd:Date with negative timezone
---
CHANGES | 4 ++++
src/zeep/xsd/types/builtins.py | 12 +++++-------
tests/test_xsd_builtins.py | 2 ++
3 files changed, 11 insertions(+), 7 deletions(-)
Index: softlayer-zeep-5.0.0/src/zeep/xsd/types/builtins.py
===================================================================
--- softlayer-zeep-5.0.0.orig/src/zeep/xsd/types/builtins.py
+++ softlayer-zeep-5.0.0/src/zeep/xsd/types/builtins.py
@@ -201,6 +201,7 @@ class Time(BuiltinType):
class Date(BuiltinType):
_default_qname = xsd_ns("date")
accepted_types = [datetime.date, str]
+ _pattern = re.compile(r"(\d{4})-(\d{2})-(\d{2})")
@check_no_collection
def xmlvalue(self, value):
@@ -210,6 +211,9 @@ class Date(BuiltinType):
@treat_whitespace("collapse")
def pythonvalue(self, value):
+ m = self._pattern.match(value)
+ if m:
+ return datetime.date(*map(int, m.groups()))
return isodate.parse_date(value)
Index: softlayer-zeep-5.0.0/tests/test_xsd_builtins.py
===================================================================
--- softlayer-zeep-5.0.0.orig/tests/test_xsd_builtins.py
+++ softlayer-zeep-5.0.0/tests/test_xsd_builtins.py
@@ -242,6 +242,8 @@ class TestDate:
instance = builtins.Date()
assert instance.pythonvalue("2016-03-04") == datetime.date(2016, 3, 4)
assert instance.pythonvalue("2001-10-26+02:00") == datetime.date(2001, 10, 26)
+ assert instance.pythonvalue("2001-10-26-02:00") == datetime.date(2001, 10, 26)
+ assert instance.pythonvalue("2024-08-21-10:00") == datetime.date(2024, 8, 21)
assert instance.pythonvalue("2001-10-26Z") == datetime.date(2001, 10, 26)
assert instance.pythonvalue("2001-10-26+00:00") == datetime.date(2001, 10, 26)
assert instance.pythonvalue("\r\n\t 2016-03-04 ") == datetime.date(2016, 3, 4)