From ca7c031573e8fc79981fe574d9eca3310cd95ec81e5b82d29544270e0673a505 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 19 Dec 2023 13:34:52 +0000 Subject: [PATCH] - Add skip-networked-test.patch to fix gh#mvantellingen/python-zeep#1402 skipping tests requiring network connection OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-softlayer-zeep?expand=0&rev=8 --- python-softlayer-zeep.changes | 7 ++++ python-softlayer-zeep.spec | 45 ++++++++++++--------- skip-networked-test.patch | 76 +++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 20 deletions(-) create mode 100644 skip-networked-test.patch diff --git a/python-softlayer-zeep.changes b/python-softlayer-zeep.changes index 041229b..7725c01 100644 --- a/python-softlayer-zeep.changes +++ b/python-softlayer-zeep.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Dec 19 13:34:00 UTC 2023 - Matej Cepl + +- 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 diff --git a/python-softlayer-zeep.spec b/python-softlayer-zeep.spec index 922cecd..b37a6c9 100644 --- a/python-softlayer-zeep.spec +++ b/python-softlayer-zeep.spec @@ -1,7 +1,7 @@ # # 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 # remain the property of their copyright owners, unless otherwise agreed @@ -16,7 +16,6 @@ # -%{?!python_module:%define python_module() python3-%{**}} %global skip_python2 1 %{?sle15_python_module_pythons} Name: python-softlayer-zeep @@ -24,10 +23,27 @@ Version: 5.0.0 Release: 0 Summary: A modern/fast Python SOAP client based on lxml / requests License: MIT +#Git-Clone: https://github.com/mvantellingen/python-zeep URL: https://docs.python-zeep.org 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 +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 BuildRequires: %{python_module attrs >= 17.2.0} 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-toolbelt >= 0.7.1} # /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 %description A modern/fast Python SOAP client based on lxml / requests %prep -%setup -q -n softlayer-zeep-%{version} +%autosetup -p1 -n softlayer-zeep-%{version} %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -%pytest +%pytest -k 'not network' %files %{python_files} %doc CHANGES README.rst %license LICENSE -%{python_sitelib}/* +%{python_sitelib}/zeep +%{python_sitelib}/softlayer_zeep-%{version}*-info %changelog diff --git a/skip-networked-test.patch b/skip-networked-test.patch new file mode 100644 index 0000000..5acf7a9 --- /dev/null +++ b/skip-networked-test.patch @@ -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")