14
0

Accepting request 1135186 from devel:languages:python

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/1135186
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-softlayer-zeep?expand=0&rev=3
This commit is contained in:
2023-12-28 22:00:49 +00:00
committed by Git OBS Bridge
3 changed files with 108 additions and 20 deletions

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Dec 19 13:34:00 UTC 2023 - Matej Cepl <mcepl@cepl.eu>
- Add skip-networked-test.patch to fix
gh#mvantellingen/python-zeep#1402 skipping tests requiring
network connection
------------------------------------------------------------------- -------------------------------------------------------------------
Sat Jul 1 09:08:59 UTC 2023 - ecsos <ecsos@opensuse.org> Sat Jul 1 09:08:59 UTC 2023 - ecsos <ecsos@opensuse.org>

View File

@@ -1,7 +1,7 @@
# #
# spec file for package python-softlayer-zeep # spec file for package python-softlayer-zeep
# #
# Copyright (c) 2022 SUSE LLC # Copyright (c) 2023 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@@ -16,7 +16,6 @@
# #
%{?!python_module:%define python_module() python3-%{**}}
%global skip_python2 1 %global skip_python2 1
%{?sle15_python_module_pythons} %{?sle15_python_module_pythons}
Name: python-softlayer-zeep Name: python-softlayer-zeep
@@ -24,10 +23,27 @@ Version: 5.0.0
Release: 0 Release: 0
Summary: A modern/fast Python SOAP client based on lxml / requests Summary: A modern/fast Python SOAP client based on lxml / requests
License: MIT License: MIT
#Git-Clone: https://github.com/mvantellingen/python-zeep
URL: https://docs.python-zeep.org URL: https://docs.python-zeep.org
Source: https://files.pythonhosted.org/packages/source/s/softlayer-zeep/softlayer-zeep-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/s/softlayer-zeep/softlayer-zeep-%{version}.tar.gz
BuildRequires: %{python_module setuptools} # 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
BuildRequires: %{python_module pip}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
Requires: python-attrs >= 17.2.0
Requires: python-isodate >= 0.5.4
Requires: python-lxml >= 4.6.0
Requires: python-platformdirs >= 1.4.0
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}
BuildArch: noarch
# SECTION test requirements # SECTION test requirements
BuildRequires: %{python_module attrs >= 17.2.0} BuildRequires: %{python_module attrs >= 17.2.0}
BuildRequires: %{python_module freezegun >= 0.3.15} BuildRequires: %{python_module freezegun >= 0.3.15}
@@ -45,39 +61,28 @@ BuildRequires: %{python_module requests-file >= 1.5.1}
BuildRequires: %{python_module requests-mock >= 0.7.0} BuildRequires: %{python_module requests-mock >= 0.7.0}
BuildRequires: %{python_module requests-toolbelt >= 0.7.1} BuildRequires: %{python_module requests-toolbelt >= 0.7.1}
# /SECTION # /SECTION
BuildRequires: fdupes
Requires: python-attrs >= 17.2.0
Requires: python-isodate >= 0.5.4
Requires: python-lxml >= 4.6.0
Requires: python-platformdirs >= 1.4.0
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
BuildArch: noarch
%python_subpackages %python_subpackages
%description %description
A modern/fast Python SOAP client based on lxml / requests A modern/fast Python SOAP client based on lxml / requests
%prep %prep
%setup -q -n softlayer-zeep-%{version} %autosetup -p1 -n softlayer-zeep-%{version}
%build %build
%python_build %pyproject_wheel
%install %install
%python_install %pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib} %python_expand %fdupes %{buildroot}%{$python_sitelib}
%check %check
%pytest %pytest -k 'not network'
%files %{python_files} %files %{python_files}
%doc CHANGES README.rst %doc CHANGES README.rst
%license LICENSE %license LICENSE
%{python_sitelib}/* %{python_sitelib}/zeep
%{python_sitelib}/softlayer_zeep-%{version}*-info
%changelog %changelog

76
skip-networked-test.patch Normal file
View File

@@ -0,0 +1,76 @@
---
pyproject.toml | 3 ++-
tests/test_cache.py | 4 ++++
tests/test_wsse_username.py | 3 +++
3 files changed, 9 insertions(+), 1 deletion(-)
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -28,5 +28,6 @@ testpaths = [
]
markers = [
# mark a test to allow socket usage
- "requests"
+ "requests",
+ "network: test case requires network connection",
]
--- a/tests/test_cache.py
+++ b/tests/test_cache.py
@@ -35,6 +35,7 @@ class TestSqliteCache:
result = c.get("http://tests.python-zeep.org/example.wsdl")
assert result is None
+ @pytest.mark.network
def test_has_expired(self, tmpdir):
c = cache.SqliteCache(path=tmpdir.join("sqlite.cache.db").strpath)
c.add("http://tests.python-zeep.org/example.wsdl", b"content")
@@ -51,6 +52,7 @@ class TestSqliteCache:
assert result == b"content"
+@pytest.mark.network
def test_memory_cache_timeout(tmpdir):
c = cache.InMemoryCache()
c.add("http://tests.python-zeep.org/example.wsdl", b"content")
@@ -76,6 +78,7 @@ class TestIsExpired:
def test_timeout_none(self):
assert cache._is_expired(100, None) is False
+ @pytest.mark.network
def test_has_expired(self):
timeout = 7200
utcnow = datetime.datetime.utcnow()
@@ -83,6 +86,7 @@ class TestIsExpired:
with freezegun.freeze_time(utcnow):
assert cache._is_expired(value, timeout) is False
+ @pytest.mark.network
def test_has_not_expired(self):
timeout = 7200
utcnow = datetime.datetime.utcnow()
--- a/tests/test_wsse_username.py
+++ b/tests/test_wsse_username.py
@@ -85,6 +85,7 @@ def test_password_text():
assert_nodes_equal(envelope, expected)
+@pytest.mark.network
@freeze_time("2016-05-08 12:00:00")
def test_password_digest(monkeypatch):
monkeypatch.setattr(os, "urandom", lambda x: b"mocked-random")
@@ -138,6 +139,7 @@ def test_password_digest(monkeypatch):
assert_nodes_equal(envelope, expected)
+@pytest.mark.network
@freeze_time("2016-05-08 12:00:00")
def test_password_digest_custom(monkeypatch):
monkeypatch.setattr(os, "urandom", lambda x: b"mocked-random")
@@ -323,6 +325,7 @@ def test_timestamp_token():
assert_nodes_equal(envelope, expected)
+@pytest.mark.network
@freeze_time("2016-05-08 12:00:00")
def test_bytes_like_password_digest(monkeypatch):
monkeypatch.setattr(os, "urandom", lambda x: b"mocked-random")