!10 update source and port to pytest4
From: @maminjie Reviewed-by: @small_leek Signed-off-by: @small_leek
This commit is contained in:
commit
d95113bbe3
Binary file not shown.
@ -1,32 +0,0 @@
|
|||||||
diff -up jurko-suds-94664ddd46a6/tests/test_transport_http.py.httptestfix jurko-suds-94664ddd46a6/tests/test_transport_http.py
|
|
||||||
--- jurko-suds-94664ddd46a6/tests/test_transport_http.py.httptestfix 2015-07-27 05:08:20.000000000 -0400
|
|
||||||
+++ jurko-suds-94664ddd46a6/tests/test_transport_http.py 2016-01-09 23:29:22.749940293 -0500
|
|
||||||
@@ -120,6 +120,9 @@ class MockFP:
|
|
||||||
def readline():
|
|
||||||
raise MustNotBeCalled
|
|
||||||
|
|
||||||
+ def close(self):
|
|
||||||
+ pass
|
|
||||||
+
|
|
||||||
|
|
||||||
class MockURLOpenerSaboteur:
|
|
||||||
"""
|
|
||||||
@@ -295,12 +298,18 @@ def test_sending_using_network_sockets(s
|
|
||||||
self.__mocker.mock_sent_data += data
|
|
||||||
def settimeout(self, *args, **kwargs):
|
|
||||||
pass
|
|
||||||
+ def setsockopt(self, level, optname, value):
|
|
||||||
+ pass
|
|
||||||
|
|
||||||
class MockSocketReader(CountedMock):
|
|
||||||
def __init__(self):
|
|
||||||
super(MockSocketReader, self).__init__()
|
|
||||||
def readline(self, *args, **kwargs):
|
|
||||||
raise MyException
|
|
||||||
+ def close(self):
|
|
||||||
+ pass
|
|
||||||
+ def flush(self):
|
|
||||||
+ pass
|
|
||||||
|
|
||||||
# Setup.
|
|
||||||
host = "an-easily-recognizable-host-name-214894932"
|
|
||||||
157
port-to-pytest4.patch
Normal file
157
port-to-pytest4.patch
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
From 0f9fc8baf101e52ce14869e97b1c05b3bd9d1fbf Mon Sep 17 00:00:00 2001
|
||||||
|
From: maminjie <maminjie1@huawei.com>
|
||||||
|
Date: Fri, 8 Jan 2021 11:27:17 +0800
|
||||||
|
Subject: [PATCH] port to pytest4
|
||||||
|
|
||||||
|
---
|
||||||
|
setup.cfg | 2 +-
|
||||||
|
tests/test_argument_parser.py | 4 ++--
|
||||||
|
tests/test_input_parameters.py | 11 ++++++-----
|
||||||
|
tests/test_request_construction.py | 9 ++++++---
|
||||||
|
tests/test_sax_encoder.py | 4 ++--
|
||||||
|
tests/testutils/indirect_parametrize.py | 12 ++++--------
|
||||||
|
6 files changed, 21 insertions(+), 21 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/setup.cfg b/setup.cfg
|
||||||
|
index 6e247b5..dee95fb 100644
|
||||||
|
--- a/setup.cfg
|
||||||
|
+++ b/setup.cfg
|
||||||
|
@@ -94,7 +94,7 @@ command = py342.cmd
|
||||||
|
[env:3.4.2 x86]
|
||||||
|
command = py342_x86.cmd
|
||||||
|
|
||||||
|
-[pytest]
|
||||||
|
+[tool:pytest]
|
||||||
|
# Folders 'pytest' unit testing framework should avoid when collecting test
|
||||||
|
# cases to run, e.g. internal build & version control system folders.
|
||||||
|
norecursedirs = .git .hg .svn build dist
|
||||||
|
diff --git a/tests/test_argument_parser.py b/tests/test_argument_parser.py
|
||||||
|
index 64a5778..402e318 100644
|
||||||
|
--- a/tests/test_argument_parser.py
|
||||||
|
+++ b/tests/test_argument_parser.py
|
||||||
|
@@ -95,7 +95,7 @@ class MockParamType:
|
||||||
|
# the argument parsing functionality. This will remove code duplication
|
||||||
|
# between different binding implementations and make their features more
|
||||||
|
# balanced.
|
||||||
|
- pytest.mark.xfail(reason="Not yet implemented.")("rpc")
|
||||||
|
+ pytest.param("rpc", marks=pytest.mark.xfail(reason="Not yet implemented.")),
|
||||||
|
))
|
||||||
|
def test_binding_uses_argument_parsing(monkeypatch, binding_style):
|
||||||
|
"""
|
||||||
|
@@ -158,7 +158,7 @@ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||||
|
# the argument parsing functionality. This will remove code duplication
|
||||||
|
# between different binding implementations and make their features more
|
||||||
|
# balanced.
|
||||||
|
- pytest.mark.xfail(reason="Not yet implemented.")("rpc")
|
||||||
|
+ pytest.param("rpc", marks=pytest.mark.xfail(reason="Not yet implemented.")),
|
||||||
|
))
|
||||||
|
def test_binding_for_an_operation_with_no_input_uses_argument_parsing(
|
||||||
|
monkeypatch, binding_style):
|
||||||
|
diff --git a/tests/test_input_parameters.py b/tests/test_input_parameters.py
|
||||||
|
index f4ab7a7..4a817a4 100644
|
||||||
|
--- a/tests/test_input_parameters.py
|
||||||
|
+++ b/tests/test_input_parameters.py
|
||||||
|
@@ -268,8 +268,8 @@ class TestUnsupportedParameterDefinitions:
|
||||||
|
self.service = client.service
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("test_args_required", (
|
||||||
|
- pytest.mark.xfail(reason="empty choice member items not supported")(
|
||||||
|
- True),
|
||||||
|
+ pytest.param(True, marks=pytest.mark.xfail(
|
||||||
|
+ reason="empty choice member items not supported")),
|
||||||
|
False))
|
||||||
|
def test_choice_containing_an_empty_sequence(self, test_args_required):
|
||||||
|
"""
|
||||||
|
@@ -295,15 +295,16 @@ class TestUnsupportedParameterDefinitions:
|
||||||
|
@pytest.mark.parametrize("choice", (
|
||||||
|
# Explicitly marked as optional and containing only non-optional
|
||||||
|
# elements.
|
||||||
|
- pytest.mark.xfail(reason="suds does not yet support minOccurs/"
|
||||||
|
- "maxOccurs attributes on all/choice/sequence order indicators")(
|
||||||
|
+ pytest.param(
|
||||||
|
"""\
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice minOccurs="0">
|
||||||
|
<xsd:element name="aString" type="xsd:string" />
|
||||||
|
<xsd:element name="anInteger" type="xsd:integer" />
|
||||||
|
</xsd:choice>
|
||||||
|
- </xsd:complexType>"""),
|
||||||
|
+ </xsd:complexType>""", marks=pytest.mark.xfail(
|
||||||
|
+ reason="suds does not yet support minOccurs/"
|
||||||
|
+ "maxOccurs attributes on all/choice/sequence order indicators")),
|
||||||
|
# Explicitly marked as optional and containing at least one
|
||||||
|
# non-optional element.
|
||||||
|
"""\
|
||||||
|
diff --git a/tests/test_request_construction.py b/tests/test_request_construction.py
|
||||||
|
index 52048cd..036bb4b 100644
|
||||||
|
--- a/tests/test_request_construction.py
|
||||||
|
+++ b/tests/test_request_construction.py
|
||||||
|
@@ -93,9 +93,12 @@ def parametrize_single_element_input_test(param_names, param_values):
|
||||||
|
args, request_body = next_value[:2]
|
||||||
|
xfail = len(next_value) == 3
|
||||||
|
param = (xsd, external_element_name, args, request_body)
|
||||||
|
- if xfail:
|
||||||
|
- param = pytest.mark.xfail(param, reason=next_value[2])
|
||||||
|
- expanded_param_values.append(param)
|
||||||
|
+ #if xfail:
|
||||||
|
+ # param = pytest.mark.xfail(param, reason=next_value[2])
|
||||||
|
+ #expanded_param_values.append(param)
|
||||||
|
+ # Manually skip xfails for now since there's no way to mark
|
||||||
|
+ if not xfail:
|
||||||
|
+ expanded_param_values.append(param)
|
||||||
|
return (param_names, expanded_param_values), {}
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/tests/test_sax_encoder.py b/tests/test_sax_encoder.py
|
||||||
|
index f7d1f37..65deb70 100644
|
||||||
|
--- a/tests/test_sax_encoder.py
|
||||||
|
+++ b/tests/test_sax_encoder.py
|
||||||
|
@@ -141,7 +141,7 @@ symmetric_decoded_encoded_test_data__broken_encode = [
|
||||||
|
(e, d) for d, e in
|
||||||
|
symmetric_decoded_encoded_test_data +
|
||||||
|
symmetric_decoded_encoded_test_data__broken_encode] + [
|
||||||
|
- pytest.mark.xfail((e, d), reason="CDATA encoding not supported yet")
|
||||||
|
+ pytest.param(e, d, marks=pytest.mark.xfail(reason="CDATA encoding not supported yet"))
|
||||||
|
for d, e in symmetric_decoded_encoded_test_data__broken] + [
|
||||||
|
# Character reference lookalikes.
|
||||||
|
(x, x) for x in (
|
||||||
|
@@ -164,7 +164,7 @@ def test_decode(input, expected):
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(("input", "expected"),
|
||||||
|
symmetric_decoded_encoded_test_data + [
|
||||||
|
- pytest.mark.xfail(x, reason="CDATA encoding not supported yet") for x in
|
||||||
|
+ pytest.param(x, y, marks=pytest.mark.xfail(reason="CDATA encoding not supported yet")) for x, y in
|
||||||
|
symmetric_decoded_encoded_test_data__broken +
|
||||||
|
symmetric_decoded_encoded_test_data__broken_encode] + [
|
||||||
|
# Double encoding.
|
||||||
|
diff --git a/tests/testutils/indirect_parametrize.py b/tests/testutils/indirect_parametrize.py
|
||||||
|
index a8f1e0f..4be9950 100644
|
||||||
|
--- a/tests/testutils/indirect_parametrize.py
|
||||||
|
+++ b/tests/testutils/indirect_parametrize.py
|
||||||
|
@@ -112,19 +112,15 @@ def pytest_configure(config):
|
||||||
|
"argument list and keyword argument dictionary) based on the received "
|
||||||
|
"input data. For more detailed information see the "
|
||||||
|
"indirect_parametrize pytest plugin implementation module.")
|
||||||
|
+ """pytest hook publishing references in the toplevel pytest namespace."""
|
||||||
|
+ pytest.indirect_parametrize = indirect_parametrize
|
||||||
|
|
||||||
|
|
||||||
|
def pytest_generate_tests(metafunc):
|
||||||
|
"""pytest hook called for all detected test functions."""
|
||||||
|
- func = metafunc.function
|
||||||
|
- try:
|
||||||
|
- mark = func.indirect_parametrize
|
||||||
|
- except AttributeError:
|
||||||
|
+ mark = metafunc.definition.get_closest_marker('indirect_parametrize')
|
||||||
|
+ if not mark:
|
||||||
|
return
|
||||||
|
args, kwargs = mark.args[0](*mark.args[1:], **mark.kwargs)
|
||||||
|
metafunc.parametrize(*args, **kwargs)
|
||||||
|
|
||||||
|
-
|
||||||
|
-def pytest_namespace():
|
||||||
|
- """pytest hook publishing references in the toplevel pytest namespace."""
|
||||||
|
- return {'indirect_parametrize': indirect_parametrize}
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
@ -1,12 +1,14 @@
|
|||||||
|
%global srcname suds
|
||||||
|
|
||||||
Name: python-suds2
|
Name: python-suds2
|
||||||
Version: 0.7
|
Version: 0.7.0
|
||||||
Release: 4
|
Release: 5
|
||||||
Summary: A python SOAP client
|
Summary: A python SOAP client
|
||||||
License: LGPLv3+
|
License: LGPLv3+
|
||||||
URL: https://bitbucket.org/jurko/suds
|
URL: https://github.com/suds-community/suds
|
||||||
Source0: https://bitbucket.org/jurko/suds/get/94664ddd46a6.tar.bz2
|
Source0: https://github.com/suds-community/suds/archive/v%{version}/%{srcname}-%{version}.tar.gz
|
||||||
Patch0: fix_http_test.patch
|
|
||||||
Patch1: fix_test_transport.patch
|
Patch1: fix_test_transport.patch
|
||||||
|
Patch2: port-to-pytest4.patch
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
Provides: python-suds = %{version}-%{release}
|
Provides: python-suds = %{version}-%{release}
|
||||||
Obsoletes: python-suds < %{version}-%{release}
|
Obsoletes: python-suds < %{version}-%{release}
|
||||||
@ -27,34 +29,26 @@ Obsoletes: python3-suds < %{version}-%{release}
|
|||||||
for Python licensed under LGPL.
|
for Python licensed under LGPL.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -c -q
|
%autosetup -n %{srcname}-%{version} -p1
|
||||||
mv jurko-suds-94664ddd46a6 python3
|
|
||||||
cd python3
|
|
||||||
%patch0 -p1
|
|
||||||
%patch1 -p1
|
|
||||||
cd -
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
cd python3
|
|
||||||
%py3_build
|
%py3_build
|
||||||
cd -
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
cd python3
|
|
||||||
%py3_install
|
%py3_install
|
||||||
cd -
|
|
||||||
|
|
||||||
%check
|
%check
|
||||||
cd python3
|
|
||||||
%{__python3} setup.py test
|
%{__python3} setup.py test
|
||||||
cd -
|
|
||||||
|
|
||||||
%files -n python3-suds2
|
%files -n python3-suds2
|
||||||
%doc python3/README.rst
|
%doc README.rst
|
||||||
%license python3/LICENSE.txt
|
%license LICENSE.txt
|
||||||
%{python3_sitelib}/*
|
%{python3_sitelib}/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Jan 08 2021 maminjie <maminjie1@huawei.com> - 0.7.0-5
|
||||||
|
- update source and port to pytest4
|
||||||
|
|
||||||
* Wed Jul 8 2020 zhanghua <zhanghua40@huawei.com> - 0.7-4
|
* Wed Jul 8 2020 zhanghua <zhanghua40@huawei.com> - 0.7-4
|
||||||
- change Name to python-suds2 and remove Subpackage python2-suds
|
- change Name to python-suds2 and remove Subpackage python2-suds
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
version_control: hg
|
version_control: github
|
||||||
src_repo: https://bitbucket.org/jurko/suds
|
src_repo: suds-community/suds
|
||||||
tag_pattern: ^v
|
tag_prefix: "^v"
|
||||||
seperator: .
|
separator: "."
|
||||||
|
|||||||
BIN
suds-0.7.0.tar.gz
Normal file
BIN
suds-0.7.0.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user