From e75721045e7588b96558c6aebec6befc1c3af335 Mon Sep 17 00:00:00 2001 From: kamyar Date: Thu, 14 May 2015 20:50:53 +0430 Subject: [PATCH] Renamed package to asyncsuds --- {suds => asyncsuds}/argparser.py | 0 {suds => asyncsuds}/bindings/binding.py | 26 +-- {suds => asyncsuds}/bindings/document.py | 8 +- {suds => asyncsuds}/bindings/multiref.py | 4 +- {suds => asyncsuds}/bindings/rpc.py | 10 +- {suds => asyncsuds}/builder.py | 4 +- {suds => asyncsuds}/cache.py | 14 +- {suds => asyncsuds}/client.py | 60 +++--- {suds => asyncsuds}/metrics.py | 2 +- {suds => asyncsuds}/mx/appender.py | 12 +- {suds => asyncsuds}/mx/basic.py | 6 +- {suds => asyncsuds}/mx/core.py | 12 +- {suds => asyncsuds}/mx/encoded.py | 12 +- {suds => asyncsuds}/mx/literal.py | 14 +- {suds => asyncsuds}/mx/typer.py | 8 +- {suds => asyncsuds}/options.py | 12 +- {suds => asyncsuds}/plugin.py | 2 +- {suds => asyncsuds}/properties.py | 0 {suds => asyncsuds}/reader.py | 18 +- {suds => asyncsuds}/resolver.py | 8 +- {suds => asyncsuds}/sax/attribute.py | 6 +- {suds => asyncsuds}/sax/date.py | 0 {suds => asyncsuds}/sax/document.py | 6 +- {suds => asyncsuds}/sax/element.py | 8 +- {suds => asyncsuds}/sax/enc.py | 0 {suds => asyncsuds}/sax/parser.py | 20 +- {suds => asyncsuds}/sax/text.py | 4 +- {suds => asyncsuds}/servicedefinition.py | 6 +- {suds => asyncsuds}/serviceproxy.py | 4 +- {suds => asyncsuds}/soaparray.py | 6 +- {suds => asyncsuds}/store.py | 4 +- {suds => asyncsuds}/sudsobject.py | 2 +- {suds => asyncsuds}/transport/http.py | 4 +- {suds => asyncsuds}/transport/https.py | 4 +- {suds => asyncsuds}/transport/options.py | 4 +- {suds => asyncsuds}/umx/attrlist.py | 6 +- {suds => asyncsuds}/umx/basic.py | 6 +- {suds => asyncsuds}/umx/core.py | 10 +- {suds => asyncsuds}/umx/encoded.py | 8 +- {suds => asyncsuds}/umx/typed.py | 10 +- {suds => asyncsuds}/version.py | 0 {suds => asyncsuds}/wsdl.py | 20 +- {suds => asyncsuds}/wsse.py | 8 +- {suds => asyncsuds}/xsd/depsort.py | 2 +- {suds => asyncsuds}/xsd/doctor.py | 6 +- {suds => asyncsuds}/xsd/query.py | 12 +- {suds => asyncsuds}/xsd/schema.py | 18 +- {suds => asyncsuds}/xsd/sxbase.py | 8 +- {suds => asyncsuds}/xsd/sxbasic.py | 14 +- {suds => asyncsuds}/xsd/sxbuiltin.py | 8 +- setup.py | 171 ++---------------- suds/sax/__init__.py | 106 ----------- test.py | 2 +- tests/external/axis1.py | 10 +- tests/external/axis2.py | 4 +- tests/external/jasper.py | 4 +- tests/external/public.py | 6 +- tests/external/rhq.py | 4 +- tests/external/saxenc.py | 4 +- tests/profiling/profile_sax_encoder.py | 6 +- tests/test_argument_parser.py | 22 +-- tests/test_cache.py | 118 ++++++------ tests/test_client.py | 140 +++++++------- tests/test_compare_sax.py | 38 ++-- tests/test_date_time.py | 2 +- tests/test_dependency_sort.py | 2 +- tests/test_document_store.py | 40 ++-- tests/test_input_parameters.py | 20 +- tests/test_plugin.py | 2 +- tests/test_reader.py | 18 +- tests/test_reply_handling.py | 56 +++--- tests/test_request_construction.py | 14 +- tests/test_sax_document.py | 12 +- tests/test_sax_element.py | 12 +- tests/test_sax_encoder.py | 6 +- tests/test_suds.py | 164 ++++++++--------- tests/test_timezone.py | 2 +- tests/test_transport.py | 10 +- tests/test_transport_http.py | 58 +++--- tests/test_xsd_builtins.py | 18 +- tests/test_xsd_element.py | 20 +- tests/testutils/__init__.py | 14 +- ...mpare_sax__pytest_assert_rewrite_needed.py | 20 +- tools/run_all_tests.py | 2 +- 84 files changed, 660 insertions(+), 913 deletions(-) rename {suds => asyncsuds}/argparser.py (100%) rename {suds => asyncsuds}/bindings/binding.py (96%) rename {suds => asyncsuds}/bindings/document.py (97%) rename {suds => asyncsuds}/bindings/multiref.py (98%) rename {suds => asyncsuds}/bindings/rpc.py (91%) rename {suds => asyncsuds}/builder.py (98%) rename {suds => asyncsuds}/cache.py (96%) rename {suds => asyncsuds}/client.py (95%) rename {suds => asyncsuds}/metrics.py (98%) rename {suds => asyncsuds}/mx/appender.py (97%) rename {suds => asyncsuds}/mx/basic.py (94%) rename {suds => asyncsuds}/mx/core.py (95%) rename {suds => asyncsuds}/mx/encoded.py (95%) rename {suds => asyncsuds}/mx/literal.py (97%) rename {suds => asyncsuds}/mx/typer.py (96%) rename {suds => asyncsuds}/options.py (96%) rename {suds => asyncsuds}/plugin.py (99%) rename {suds => asyncsuds}/properties.py (100%) rename {suds => asyncsuds}/reader.py (93%) rename {suds => asyncsuds}/resolver.py (98%) rename {suds => asyncsuds}/sax/attribute.py (98%) rename {suds => asyncsuds}/sax/date.py (100%) rename {suds => asyncsuds}/sax/document.py (98%) rename {suds => asyncsuds}/sax/element.py (99%) rename {suds => asyncsuds}/sax/enc.py (100%) rename {suds => asyncsuds}/sax/parser.py (89%) rename {suds => asyncsuds}/sax/text.py (98%) rename {suds => asyncsuds}/servicedefinition.py (98%) rename {suds => asyncsuds}/serviceproxy.py (97%) rename {suds => asyncsuds}/soaparray.py (93%) rename {suds => asyncsuds}/store.py (99%) rename {suds => asyncsuds}/sudsobject.py (99%) rename {suds => asyncsuds}/transport/http.py (98%) rename {suds => asyncsuds}/transport/https.py (96%) rename {suds => asyncsuds}/transport/options.py (96%) rename {suds => asyncsuds}/umx/attrlist.py (96%) rename {suds => asyncsuds}/umx/basic.py (93%) rename {suds => asyncsuds}/umx/core.py (97%) rename {suds => asyncsuds}/umx/encoded.py (96%) rename {suds => asyncsuds}/umx/typed.py (96%) rename {suds => asyncsuds}/version.py (100%) rename {suds => asyncsuds}/wsdl.py (98%) rename {suds => asyncsuds}/wsse.py (97%) rename {suds => asyncsuds}/xsd/depsort.py (99%) rename {suds => asyncsuds}/xsd/doctor.py (97%) rename {suds => asyncsuds}/xsd/query.py (96%) rename {suds => asyncsuds}/xsd/schema.py (97%) rename {suds => asyncsuds}/xsd/sxbase.py (99%) rename {suds => asyncsuds}/xsd/sxbasic.py (98%) rename {suds => asyncsuds}/xsd/sxbuiltin.py (98%) delete mode 100644 suds/sax/__init__.py diff --git a/suds/argparser.py b/asyncsuds/argparser.py similarity index 100% rename from suds/argparser.py rename to asyncsuds/argparser.py diff --git a/suds/bindings/binding.py b/asyncsuds/bindings/binding.py similarity index 96% rename from suds/bindings/binding.py rename to asyncsuds/bindings/binding.py index 5bafaec9..4d47c9fa 100644 --- a/suds/bindings/binding.py +++ b/asyncsuds/bindings/binding.py @@ -18,19 +18,19 @@ """ -from suds import * -from suds.sax import Namespace -from suds.sax.document import Document -from suds.sax.element import Element -from suds.sudsobject import Factory -from suds.mx import Content -from suds.mx.literal import Literal as MxLiteral -from suds.umx.typed import Typed as UmxTyped -from suds.bindings.multiref import MultiRef -from suds.xsd.query import TypeQuery, ElementQuery -from suds.xsd.sxbasic import Element as SchemaElement -from suds.options import Options -from suds.plugin import PluginContainer +from asyncsuds import * +from asyncsuds.sax import Namespace +from asyncsuds.sax.document import Document +from asyncsuds.sax.element import Element +from asyncsuds.sudsobject import Factory +from asyncsuds.mx import Content +from asyncsuds.mx.literal import Literal as MxLiteral +from asyncsuds.umx.typed import Typed as UmxTyped +from asyncsuds.bindings.multiref import MultiRef +from asyncsuds.xsd.query import TypeQuery, ElementQuery +from asyncsuds.xsd.sxbasic import Element as SchemaElement +from asyncsuds.options import Options +from asyncsuds.plugin import PluginContainer from copy import deepcopy diff --git a/suds/bindings/document.py b/asyncsuds/bindings/document.py similarity index 97% rename from suds/bindings/document.py rename to asyncsuds/bindings/document.py index 8d36fb27..d645b413 100644 --- a/suds/bindings/document.py +++ b/asyncsuds/bindings/document.py @@ -18,10 +18,10 @@ """ -from suds import * -from suds.argparser import parse_args -from suds.bindings.binding import Binding -from suds.sax.element import Element +from asyncsuds import * +from asyncsuds.argparser import parse_args +from asyncsuds.bindings.binding import Binding +from asyncsuds.sax.element import Element class Document(Binding): diff --git a/suds/bindings/multiref.py b/asyncsuds/bindings/multiref.py similarity index 98% rename from suds/bindings/multiref.py rename to asyncsuds/bindings/multiref.py index 52fa47ad..2b47cb8e 100644 --- a/suds/bindings/multiref.py +++ b/asyncsuds/bindings/multiref.py @@ -17,8 +17,8 @@ Provides classes for handling soap multirefs. """ -from suds import * -from suds.sax.element import Element +from asyncsuds import * +from asyncsuds.sax.element import Element soapenc = (None, 'http://schemas.xmlsoap.org/soap/encoding/') diff --git a/suds/bindings/rpc.py b/asyncsuds/bindings/rpc.py similarity index 91% rename from suds/bindings/rpc.py rename to asyncsuds/bindings/rpc.py index f0d5bd9e..1d3c68e7 100644 --- a/suds/bindings/rpc.py +++ b/asyncsuds/bindings/rpc.py @@ -18,11 +18,11 @@ """ -from suds import * -from suds.mx.encoded import Encoded as MxEncoded -from suds.umx.encoded import Encoded as UmxEncoded -from suds.bindings.binding import Binding, envns -from suds.sax.element import Element +from asyncsuds import * +from asyncsuds.mx.encoded import Encoded as MxEncoded +from asyncsuds.umx.encoded import Encoded as UmxEncoded +from asyncsuds.bindings.binding import Binding, envns +from asyncsuds.sax.element import Element encns = ("SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/") diff --git a/suds/builder.py b/asyncsuds/builder.py similarity index 98% rename from suds/builder.py rename to asyncsuds/builder.py index 42eba0b4..d69ef2bf 100644 --- a/suds/builder.py +++ b/asyncsuds/builder.py @@ -18,8 +18,8 @@ The I{builder} module provides an wsdl/xsd defined types factory """ -from suds import * -from suds.sudsobject import Factory +from asyncsuds import * +from asyncsuds.sudsobject import Factory class Builder: diff --git a/suds/cache.py b/asyncsuds/cache.py similarity index 96% rename from suds/cache.py rename to asyncsuds/cache.py index f3cac3f3..3e125389 100644 --- a/suds/cache.py +++ b/asyncsuds/cache.py @@ -18,9 +18,9 @@ """ -import suds -import suds.sax.element -import suds.sax.parser +import asyncsuds +import asyncsuds.sax.element +import asyncsuds.sax.parser import datetime import os @@ -196,7 +196,7 @@ def __check_version(self): version = f.read() finally: f.close() - if version != suds.__version__: + if version != asyncsuds.__version__: raise Exception() except Exception: self.clear() @@ -288,7 +288,7 @@ def get(self, id): fp = self._getf(id) if fp is None: return None - p = suds.sax.parser.Parser() + p = asyncsuds.sax.parser.Parser() return p.parse(fp) except Exception: if fp is not None: @@ -297,8 +297,8 @@ def get(self, id): def put(self, id, object): if isinstance(object, - (suds.sax.document.Document, suds.sax.element.Element)): - super(DocumentCache, self).put(id, suds.byte_str(str(object))) + (asyncsuds.sax.document.Document, asyncsuds.sax.element.Element)): + super(DocumentCache, self).put(id, asyncsuds.byte_str(str(object))) return object diff --git a/suds/client.py b/asyncsuds/client.py similarity index 95% rename from suds/client.py rename to asyncsuds/client.py index 64d80929..210dd60f 100644 --- a/suds/client.py +++ b/asyncsuds/client.py @@ -18,25 +18,25 @@ """ -import suds -from suds import * -import suds.bindings.binding -from suds.builder import Builder -import suds.cache -import suds.metrics as metrics -from suds.options import Options -from suds.plugin import PluginContainer -from suds.properties import Unskin -from suds.reader import DefinitionsReader -from suds.resolver import PathResolver -from suds.sax.document import Document -import suds.sax.parser -from suds.servicedefinition import ServiceDefinition -import suds.transport -import suds.transport.https -from suds.umx.basic import Basic as UmxBasic -from suds.wsdl import Definitions -from suds import sudsobject +import asyncsuds +from asyncsuds import * +import asyncsuds.bindings.binding +from asyncsuds.builder import Builder +import asyncsuds.cache +import asyncsuds.metrics as metrics +from asyncsuds.options import Options +from asyncsuds.plugin import PluginContainer +from asyncsuds.properties import Unskin +from asyncsuds.reader import DefinitionsReader +from asyncsuds.resolver import PathResolver +from asyncsuds.sax.document import Document +import asyncsuds.sax.parser +from asyncsuds.servicedefinition import ServiceDefinition +import asyncsuds.transport +import asyncsuds.transport.https +from asyncsuds.umx.basic import Basic as UmxBasic +from asyncsuds.wsdl import Definitions +from asyncsuds import sudsobject from http.cookiejar import CookieJar from copy import deepcopy @@ -112,10 +112,10 @@ def __init__(self, url, **kwargs): """ options = Options() - options.transport = suds.transport.https.HttpAuthenticated() + options.transport = asyncsuds.transport.https.HttpAuthenticated() self.options = options if "cache" not in kwargs: - kwargs["cache"] = suds.cache.ObjectCache(days=1) + kwargs["cache"] = asyncsuds.cache.ObjectCache(days=1) self.set_options(**kwargs) self.url = url @@ -195,9 +195,9 @@ def __init__(self): def __str__(self): s = ["\n"] s.append("Suds ( https://fedorahosted.org/suds/ )") - s.append(" version: %s" % (suds.__version__,)) - if suds.__build__: - s.append(" build: %s" % (suds.__build__,)) + s.append(" version: %s" % (asyncsuds.__version__,)) + if asyncsuds.__build__: + s.append(" build: %s" % (asyncsuds.__build__,)) for sd in self.sd_list: s.append("\n\n%s" % (str(sd),)) return "".join(s) @@ -747,7 +747,7 @@ def send(self, soapenv): soapenv = ctx.envelope if self.options.nosend: return RequestContext(self.process_reply, soapenv) - request = suds.transport.Request(location, soapenv) + request = asyncsuds.transport.Request(location, soapenv) request.headers = self.__headers() try: timer = metrics.Timer() @@ -755,7 +755,7 @@ def send(self, soapenv): reply = yield from self.options.transport.send(request) timer.stop() metrics.log.debug("waited %s on server reply", timer) - except suds.transport.TransportError as e: + except asyncsuds.transport.TransportError as e: content = e.fp and e.fp.read() or "" return self.process_reply(content, e.httpcode, tostr(e)) return self.process_reply(reply, None, None) @@ -851,7 +851,7 @@ def __get_fault(self, replyroot): @rtype: L{Object} """ - envns = suds.bindings.binding.envns + envns = asyncsuds.bindings.binding.envns soapenv = replyroot and replyroot.getChild("Envelope", envns) soapbody = soapenv and soapenv.getChild("Body", envns) fault = soapbody and soapbody.getChild("Fault", envns) @@ -921,13 +921,13 @@ def invoke(self, args, kwargs): simulation = kwargs.pop(self.__injkey) msg = simulation.get("msg") if msg is not None: - assert msg.__class__ is suds.byte_str_class + assert msg.__class__ is asyncsuds.byte_str_class return self.send(_parse(msg)) msg = self.method.binding.input.get_message(self.method, args, kwargs) log.debug("inject (simulated) send message:\n%s", msg) reply = simulation.get("reply") if reply is not None: - assert reply.__class__ is suds.byte_str_class + assert reply.__class__ is asyncsuds.byte_str_class status = simulation.get("status") description = simulation.get("description") if description is None: @@ -950,4 +950,4 @@ def _parse(string): """ if string: - return suds.sax.parser.Parser().parse(string=string) + return asyncsuds.sax.parser.Parser().parse(string=string) diff --git a/suds/metrics.py b/asyncsuds/metrics.py similarity index 98% rename from suds/metrics.py rename to asyncsuds/metrics.py index 9b15f18a..2caff0d0 100644 --- a/suds/metrics.py +++ b/asyncsuds/metrics.py @@ -20,7 +20,7 @@ """ import time -from suds import * +from asyncsuds import * from math import modf from logging import getLogger diff --git a/suds/mx/appender.py b/asyncsuds/mx/appender.py similarity index 97% rename from suds/mx/appender.py rename to asyncsuds/mx/appender.py index 726e2627..c7e0de5d 100644 --- a/suds/mx/appender.py +++ b/asyncsuds/mx/appender.py @@ -18,12 +18,12 @@ Provides appender classes for I{marshalling}. """ -from suds import * -from suds.mx import * -from suds.sudsobject import footprint -from suds.sudsobject import Object, Property -from suds.sax.element import Element -from suds.sax.text import Text +from asyncsuds import * +from asyncsuds.mx import * +from asyncsuds.sudsobject import footprint +from asyncsuds.sudsobject import Object, Property +from asyncsuds.sax.element import Element +from asyncsuds.sax.text import Text class Matcher: diff --git a/suds/mx/basic.py b/asyncsuds/mx/basic.py similarity index 94% rename from suds/mx/basic.py rename to asyncsuds/mx/basic.py index b2de1611..5974198a 100644 --- a/suds/mx/basic.py +++ b/asyncsuds/mx/basic.py @@ -18,9 +18,9 @@ Provides basic I{marshaller} classes. """ -from suds import * -from suds.mx import * -from suds.mx.core import Core +from asyncsuds import * +from asyncsuds.mx import * +from asyncsuds.mx.core import Core class Basic(Core): diff --git a/suds/mx/core.py b/asyncsuds/mx/core.py similarity index 95% rename from suds/mx/core.py rename to asyncsuds/mx/core.py index b7fe24c1..5069d460 100644 --- a/suds/mx/core.py +++ b/asyncsuds/mx/core.py @@ -18,12 +18,12 @@ Provides I{marshaller} core classes. """ -from suds import * -from suds.mx import * -from suds.mx.appender import ContentAppender -from suds.sax.element import Element -from suds.sax.document import Document -from suds.sudsobject import Property +from asyncsuds import * +from asyncsuds.mx import * +from asyncsuds.mx.appender import ContentAppender +from asyncsuds.sax.element import Element +from asyncsuds.sax.document import Document +from asyncsuds.sudsobject import Property from logging import getLogger log = getLogger(__name__) diff --git a/suds/mx/encoded.py b/asyncsuds/mx/encoded.py similarity index 95% rename from suds/mx/encoded.py rename to asyncsuds/mx/encoded.py index 1f1181ad..fd01ca60 100644 --- a/suds/mx/encoded.py +++ b/asyncsuds/mx/encoded.py @@ -18,12 +18,12 @@ Provides encoded I{marshaller} classes. """ -from suds import * -from suds.mx import * -from suds.mx.literal import Literal -from suds.mx.typer import Typer -from suds.sudsobject import Factory, Object -from suds.xsd.query import TypeQuery +from asyncsuds import * +from asyncsuds.mx import * +from asyncsuds.mx.literal import Literal +from asyncsuds.mx.typer import Typer +from asyncsuds.sudsobject import Factory, Object +from asyncsuds.xsd.query import TypeQuery # diff --git a/suds/mx/literal.py b/asyncsuds/mx/literal.py similarity index 97% rename from suds/mx/literal.py rename to asyncsuds/mx/literal.py index d8eda3bd..d016cd2c 100644 --- a/suds/mx/literal.py +++ b/asyncsuds/mx/literal.py @@ -18,13 +18,13 @@ Provides literal I{marshaller} classes. """ -from suds import * -from suds.mx import * -from suds.mx.core import Core -from suds.mx.typer import Typer -from suds.resolver import GraphResolver, Frame -from suds.sax.element import Element -from suds.sudsobject import Factory +from asyncsuds import * +from asyncsuds.mx import * +from asyncsuds.mx.core import Core +from asyncsuds.mx.typer import Typer +from asyncsuds.resolver import GraphResolver, Frame +from asyncsuds.sax.element import Element +from asyncsuds.sudsobject import Factory from logging import getLogger log = getLogger(__name__) diff --git a/suds/mx/typer.py b/asyncsuds/mx/typer.py similarity index 96% rename from suds/mx/typer.py rename to asyncsuds/mx/typer.py index 0025eda0..cd76856c 100644 --- a/suds/mx/typer.py +++ b/asyncsuds/mx/typer.py @@ -18,10 +18,10 @@ Provides sx typing classes. """ -from suds import * -from suds.mx import * -from suds.sax import Namespace as NS -from suds.sax.text import Text +from asyncsuds import * +from asyncsuds.mx import * +from asyncsuds.sax import Namespace as NS +from asyncsuds.sax.text import Text class Typer: diff --git a/suds/options.py b/asyncsuds/options.py similarity index 96% rename from suds/options.py rename to asyncsuds/options.py index 8be480fb..4c49d457 100644 --- a/suds/options.py +++ b/asyncsuds/options.py @@ -18,12 +18,12 @@ Suds basic options classes. """ -from suds.cache import Cache, NoCache -from suds.properties import * -from suds.store import DocumentStore, defaultDocumentStore -from suds.transport import Transport -from suds.wsse import Security -from suds.xsd.doctor import Doctor +from asyncsuds.cache import Cache, NoCache +from asyncsuds.properties import * +from asyncsuds.store import DocumentStore, defaultDocumentStore +from asyncsuds.transport import Transport +from asyncsuds.wsse import Security +from asyncsuds.xsd.doctor import Doctor class TpLinker(AutoLinker): diff --git a/suds/plugin.py b/asyncsuds/plugin.py similarity index 99% rename from suds/plugin.py rename to asyncsuds/plugin.py index c078ddde..c18ae5ef 100644 --- a/suds/plugin.py +++ b/asyncsuds/plugin.py @@ -18,7 +18,7 @@ """ -from suds import * +from asyncsuds import * from logging import getLogger log = getLogger(__name__) diff --git a/suds/properties.py b/asyncsuds/properties.py similarity index 100% rename from suds/properties.py rename to asyncsuds/properties.py diff --git a/suds/reader.py b/asyncsuds/reader.py similarity index 93% rename from suds/reader.py rename to asyncsuds/reader.py index bb02ca63..8d84ff17 100644 --- a/suds/reader.py +++ b/asyncsuds/reader.py @@ -19,10 +19,10 @@ """ -import suds.cache -import suds.plugin -import suds.sax.parser -import suds.transport +import asyncsuds.cache +import asyncsuds.plugin +import asyncsuds.sax.parser +import asyncsuds.transport import asyncio from hashlib import md5 @@ -44,7 +44,7 @@ def __init__(self, options): """ self.options = options - self.plugins = suds.plugin.PluginContainer(options.plugins) + self.plugins = asyncsuds.plugin.PluginContainer(options.plugins) def mangle(self, name, x): """ @@ -120,7 +120,7 @@ def __cache(self): """ if self.options.cachingpolicy == 1: return self.options.cache - return suds.cache.NoCache() + return asyncsuds.cache.NoCache() class DocumentReader(Reader): @@ -160,7 +160,7 @@ def __cache(self): """ if self.options.cachingpolicy == 0: return self.options.cache - return suds.cache.NoCache() + return asyncsuds.cache.NoCache() @asyncio.coroutine def __fetch(self, url): @@ -185,9 +185,9 @@ def __fetch(self, url): if store is not None: content = store.open(url) if content is None: - request = suds.transport.Request(url) + request = asyncsuds.transport.Request(url) content = yield from self.options.transport.open(request) ctx = self.plugins.document.loaded(url=url, document=content) content = ctx.document - sax = suds.sax.parser.Parser() + sax = asyncsuds.sax.parser.Parser() return sax.parse(string=content) diff --git a/suds/resolver.py b/asyncsuds/resolver.py similarity index 98% rename from suds/resolver.py rename to asyncsuds/resolver.py index a7b15d3d..0486b70d 100644 --- a/suds/resolver.py +++ b/asyncsuds/resolver.py @@ -19,10 +19,10 @@ provide wsdl/xsd named type resolution. """ -from suds import * -from suds.sax import splitPrefix, Namespace -from suds.sudsobject import Object -from suds.xsd.query import BlindQuery, TypeQuery, qualify +from asyncsuds import * +from asyncsuds.sax import splitPrefix, Namespace +from asyncsuds.sudsobject import Object +from asyncsuds.xsd.query import BlindQuery, TypeQuery, qualify import re diff --git a/suds/sax/attribute.py b/asyncsuds/sax/attribute.py similarity index 98% rename from suds/sax/attribute.py rename to asyncsuds/sax/attribute.py index a1f99e81..55063bd5 100644 --- a/suds/sax/attribute.py +++ b/asyncsuds/sax/attribute.py @@ -18,9 +18,9 @@ Provides XML I{attribute} classes. """ -from suds import * -from suds.sax import * -from suds.sax.text import Text +from asyncsuds import * +from asyncsuds.sax import * +from asyncsuds.sax.text import Text class Attribute(object): diff --git a/suds/sax/date.py b/asyncsuds/sax/date.py similarity index 100% rename from suds/sax/date.py rename to asyncsuds/sax/date.py diff --git a/suds/sax/document.py b/asyncsuds/sax/document.py similarity index 98% rename from suds/sax/document.py rename to asyncsuds/sax/document.py index 58eacf0b..e5618427 100644 --- a/suds/sax/document.py +++ b/asyncsuds/sax/document.py @@ -18,9 +18,9 @@ Provides XML I{document} classes. """ -from suds import * -from suds.sax import * -from suds.sax.element import Element +from asyncsuds import * +from asyncsuds.sax import * +from asyncsuds.sax.element import Element class Document(object): diff --git a/suds/sax/element.py b/asyncsuds/sax/element.py similarity index 99% rename from suds/sax/element.py rename to asyncsuds/sax/element.py index 8e2064de..896f5619 100644 --- a/suds/sax/element.py +++ b/asyncsuds/sax/element.py @@ -18,10 +18,10 @@ """ -from suds import * -from suds.sax import * -from suds.sax.text import Text -from suds.sax.attribute import Attribute +from asyncsuds import * +from asyncsuds.sax import * +from asyncsuds.sax.text import Text +from asyncsuds.sax.attribute import Attribute class Element(object): diff --git a/suds/sax/enc.py b/asyncsuds/sax/enc.py similarity index 100% rename from suds/sax/enc.py rename to asyncsuds/sax/enc.py diff --git a/suds/sax/parser.py b/asyncsuds/sax/parser.py similarity index 89% rename from suds/sax/parser.py rename to asyncsuds/sax/parser.py index 2fd94076..04fe39e6 100644 --- a/suds/sax/parser.py +++ b/asyncsuds/sax/parser.py @@ -25,13 +25,13 @@ """ -import suds -from suds import * -from suds.sax import * -from suds.sax.attribute import Attribute -from suds.sax.document import Document -from suds.sax.element import Element -from suds.sax.text import Text +import asyncsuds +from asyncsuds import * +from asyncsuds.sax import * +from asyncsuds.sax.attribute import Attribute +from asyncsuds.sax.document import Document +from asyncsuds.sax.element import Element +from asyncsuds.sax.text import Text import sys from xml.sax import make_parser, InputSource, ContentHandler @@ -122,7 +122,7 @@ def parse(self, file=None, string=None): """ if file is None and string is None: return - timer = suds.metrics.Timer() + timer = asyncsuds.metrics.Timer() timer.start() source = file if file is None: @@ -132,7 +132,7 @@ def parse(self, file=None, string=None): sax.parse(source) timer.stop() if file is None: - suds.metrics.log.debug("%s\nsax duration: %s", string, timer) + asyncsuds.metrics.log.debug("%s\nsax duration: %s", string, timer) else: - suds.metrics.log.debug("sax (%s) duration: %s", file, timer) + asyncsuds.metrics.log.debug("sax (%s) duration: %s", file, timer) return handler.nodes[0] diff --git a/suds/sax/text.py b/asyncsuds/sax/text.py similarity index 98% rename from suds/sax/text.py rename to asyncsuds/sax/text.py index 33b668b7..645c1555 100644 --- a/suds/sax/text.py +++ b/asyncsuds/sax/text.py @@ -18,8 +18,8 @@ Contains XML text classes. """ -from suds import * -from suds import sax +from asyncsuds import * +from asyncsuds import sax class Text(str): diff --git a/suds/servicedefinition.py b/asyncsuds/servicedefinition.py similarity index 98% rename from suds/servicedefinition.py rename to asyncsuds/servicedefinition.py index c2650d2a..ff5b10ab 100644 --- a/suds/servicedefinition.py +++ b/asyncsuds/servicedefinition.py @@ -18,9 +18,9 @@ The I{service definition} provides a textual representation of a service. """ -from suds import * -import suds.metrics as metrics -from suds.sax import Namespace +from asyncsuds import * +import asyncsuds.metrics as metrics +from asyncsuds.sax import Namespace from logging import getLogger log = getLogger(__name__) diff --git a/suds/serviceproxy.py b/asyncsuds/serviceproxy.py similarity index 97% rename from suds/serviceproxy.py rename to asyncsuds/serviceproxy.py index 98701731..23f2dd1a 100644 --- a/suds/serviceproxy.py +++ b/asyncsuds/serviceproxy.py @@ -20,8 +20,8 @@ Replaced by: L{client.Client} """ -from suds import * -from suds.client import Client +from asyncsuds import * +from asyncsuds.client import Client class ServiceProxy(object): diff --git a/suds/soaparray.py b/asyncsuds/soaparray.py similarity index 93% rename from suds/soaparray.py rename to asyncsuds/soaparray.py index ea04fa7a..093664b6 100644 --- a/suds/soaparray.py +++ b/asyncsuds/soaparray.py @@ -19,10 +19,10 @@ soap (section 5) encoded arrays. """ -from suds import * +from asyncsuds import * from logging import getLogger -from suds.xsd.sxbasic import Factory as SXFactory -from suds.xsd.sxbasic import Attribute as SXAttribute +from asyncsuds.xsd.sxbasic import Factory as SXFactory +from asyncsuds.xsd.sxbasic import Attribute as SXAttribute class Attribute(SXAttribute): diff --git a/suds/store.py b/asyncsuds/store.py similarity index 99% rename from suds/store.py rename to asyncsuds/store.py index 799c74b1..6561a541 100644 --- a/suds/store.py +++ b/asyncsuds/store.py @@ -20,10 +20,10 @@ """ -import suds +import asyncsuds -soap5_encoding_schema = suds.byte_str("""\ +soap5_encoding_schema = asyncsuds.byte_str("""\ object I{unmarshalling}. """ -from suds import * -from suds.umx import * -from suds.umx.attrlist import AttrList -from suds.sax.text import Text -from suds.sudsobject import Factory, merge +from asyncsuds import * +from asyncsuds.umx import * +from asyncsuds.umx.attrlist import AttrList +from asyncsuds.sax.text import Text +from asyncsuds.sudsobject import Factory, merge reserved = {'class':'cls', 'def':'dfn'} diff --git a/suds/umx/encoded.py b/asyncsuds/umx/encoded.py similarity index 96% rename from suds/umx/encoded.py rename to asyncsuds/umx/encoded.py index bb454e1c..47b4573a 100644 --- a/suds/umx/encoded.py +++ b/asyncsuds/umx/encoded.py @@ -18,10 +18,10 @@ Provides soap encoded unmarshaller classes. """ -from suds import * -from suds.umx import * -from suds.umx.typed import Typed -from suds.sax import Namespace +from asyncsuds import * +from asyncsuds.umx import * +from asyncsuds.umx.typed import Typed +from asyncsuds.sax import Namespace # diff --git a/suds/umx/typed.py b/asyncsuds/umx/typed.py similarity index 96% rename from suds/umx/typed.py rename to asyncsuds/umx/typed.py index 7ab83298..fd616f5b 100644 --- a/suds/umx/typed.py +++ b/asyncsuds/umx/typed.py @@ -18,11 +18,11 @@ Provides typed unmarshaller classes. """ -from suds import * -from suds.umx import * -from suds.umx.core import Core -from suds.resolver import NodeResolver, Frame -from suds.sudsobject import Factory +from asyncsuds import * +from asyncsuds.umx import * +from asyncsuds.umx.core import Core +from asyncsuds.resolver import NodeResolver, Frame +from asyncsuds.sudsobject import Factory from logging import getLogger log = getLogger(__name__) diff --git a/suds/version.py b/asyncsuds/version.py similarity index 100% rename from suds/version.py rename to asyncsuds/version.py diff --git a/suds/wsdl.py b/asyncsuds/wsdl.py similarity index 98% rename from suds/wsdl.py rename to asyncsuds/wsdl.py index 029bd552..a0611da9 100644 --- a/suds/wsdl.py +++ b/asyncsuds/wsdl.py @@ -21,18 +21,18 @@ """ -from suds import * -from suds.bindings.document import Document -from suds.bindings.rpc import RPC, Encoded -from suds.reader import DocumentReader -from suds.sax.element import Element -from suds.sudsobject import Object, Facade, Metadata -from suds.xsd import qualify, Namespace -from suds.xsd.query import ElementQuery -from suds.xsd.schema import Schema, SchemaCollection +from asyncsuds import * +from asyncsuds.bindings.document import Document +from asyncsuds.bindings.rpc import RPC, Encoded +from asyncsuds.reader import DocumentReader +from asyncsuds.sax.element import Element +from asyncsuds.sudsobject import Object, Facade, Metadata +from asyncsuds.xsd import qualify, Namespace +from asyncsuds.xsd.query import ElementQuery +from asyncsuds.xsd.schema import Schema, SchemaCollection import re -from suds import soaparray +from asyncsuds import soaparray from urllib.parse import urljoin import asyncio diff --git a/suds/wsse.py b/asyncsuds/wsse.py similarity index 97% rename from suds/wsse.py rename to asyncsuds/wsse.py index f0796dd7..444233ca 100644 --- a/suds/wsse.py +++ b/asyncsuds/wsse.py @@ -19,10 +19,10 @@ """ from logging import getLogger -from suds import * -from suds.sudsobject import Object -from suds.sax.element import Element -from suds.sax.date import DateTime, UtcTimezone +from asyncsuds import * +from asyncsuds.sudsobject import Object +from asyncsuds.sax.element import Element +from asyncsuds.sax.date import DateTime, UtcTimezone from datetime import datetime, timedelta from hashlib import md5 diff --git a/suds/xsd/depsort.py b/asyncsuds/xsd/depsort.py similarity index 99% rename from suds/xsd/depsort.py rename to asyncsuds/xsd/depsort.py index b05fab4c..6a9cdcce 100644 --- a/suds/xsd/depsort.py +++ b/asyncsuds/xsd/depsort.py @@ -18,7 +18,7 @@ """ -from suds import * +from asyncsuds import * from logging import getLogger log = getLogger(__name__) diff --git a/suds/xsd/doctor.py b/asyncsuds/xsd/doctor.py similarity index 97% rename from suds/xsd/doctor.py rename to asyncsuds/xsd/doctor.py index 5a52e76c..caece609 100644 --- a/suds/xsd/doctor.py +++ b/asyncsuds/xsd/doctor.py @@ -19,9 +19,9 @@ schema(s). """ -from suds.sax import Namespace -from suds.sax.element import Element -from suds.plugin import DocumentPlugin, DocumentContext +from asyncsuds.sax import Namespace +from asyncsuds.sax.element import Element +from asyncsuds.plugin import DocumentPlugin, DocumentContext from logging import getLogger log = getLogger(__name__) diff --git a/suds/xsd/query.py b/asyncsuds/xsd/query.py similarity index 96% rename from suds/xsd/query.py rename to asyncsuds/xsd/query.py index 40923253..7b5ca089 100644 --- a/suds/xsd/query.py +++ b/asyncsuds/xsd/query.py @@ -18,10 +18,10 @@ The I{query} module defines a class for performing schema queries. """ -from suds import * -from suds.sudsobject import * -from suds.xsd import qualify, isqref -from suds.xsd.sxbuiltin import Factory +from asyncsuds import * +from asyncsuds.sudsobject import * +from asyncsuds.xsd import qualify, isqref +from asyncsuds.xsd.sxbuiltin import Factory from logging import getLogger log = getLogger(__name__) @@ -159,7 +159,7 @@ def execute(self, schema): return self.result(result) def __deepsearch(self, schema): - from suds.xsd.sxbasic import Attribute + from asyncsuds.xsd.sxbasic import Attribute result = None for e in schema.all: result = e.find(self.ref, (Attribute,)) @@ -197,7 +197,7 @@ def execute(self, schema): return self.result(result) def __deepsearch(self, schema): - from suds.xsd.sxbasic import Element + from asyncsuds.xsd.sxbasic import Element result = None for e in schema.all: result = e.find(self.ref, (Element,)) diff --git a/suds/xsd/schema.py b/asyncsuds/xsd/schema.py similarity index 97% rename from suds/xsd/schema.py rename to asyncsuds/xsd/schema.py index afcd8b53..a52e950b 100644 --- a/suds/xsd/schema.py +++ b/asyncsuds/xsd/schema.py @@ -22,15 +22,15 @@ """ -from suds import * -from suds.xsd import * -from suds.xsd.depsort import dependency_sort -from suds.xsd.sxbuiltin import * -from suds.xsd.sxbase import SchemaObject -from suds.xsd.sxbasic import Factory as BasicFactory -from suds.xsd.sxbuiltin import Factory as BuiltinFactory -from suds.sax import splitPrefix, Namespace -from suds.sax.element import Element +from asyncsuds import * +from asyncsuds.xsd import * +from asyncsuds.xsd.depsort import dependency_sort +from asyncsuds.xsd.sxbuiltin import * +from asyncsuds.xsd.sxbase import SchemaObject +from asyncsuds.xsd.sxbasic import Factory as BasicFactory +from asyncsuds.xsd.sxbuiltin import Factory as BuiltinFactory +from asyncsuds.sax import splitPrefix, Namespace +from asyncsuds.sax.element import Element from logging import getLogger log = getLogger(__name__) diff --git a/suds/xsd/sxbase.py b/asyncsuds/xsd/sxbase.py similarity index 99% rename from suds/xsd/sxbase.py rename to asyncsuds/xsd/sxbase.py index 9de2ab9f..75459095 100644 --- a/suds/xsd/sxbase.py +++ b/asyncsuds/xsd/sxbase.py @@ -15,10 +15,10 @@ """I{Base} classes representing XSD schema objects.""" -from suds import * -from suds.xsd import * -from suds.sax.element import Element -from suds.sax import Namespace +from asyncsuds import * +from asyncsuds.xsd import * +from asyncsuds.sax.element import Element +from asyncsuds.sax import Namespace from logging import getLogger log = getLogger(__name__) diff --git a/suds/xsd/sxbasic.py b/asyncsuds/xsd/sxbasic.py similarity index 98% rename from suds/xsd/sxbasic.py rename to asyncsuds/xsd/sxbasic.py index 38b3ab69..c72b1bf1 100644 --- a/suds/xsd/sxbasic.py +++ b/asyncsuds/xsd/sxbasic.py @@ -15,13 +15,13 @@ """Classes representing I{basic} XSD schema objects.""" -from suds import * -from suds.reader import DocumentReader -from suds.sax import Namespace -from suds.transport import TransportError -from suds.xsd import * -from suds.xsd.query import * -from suds.xsd.sxbase import * +from asyncsuds import * +from asyncsuds.reader import DocumentReader +from asyncsuds.sax import Namespace +from asyncsuds.transport import TransportError +from asyncsuds.xsd import * +from asyncsuds.xsd.query import * +from asyncsuds.xsd.sxbase import * from urllib.parse import urljoin diff --git a/suds/xsd/sxbuiltin.py b/asyncsuds/xsd/sxbuiltin.py similarity index 98% rename from suds/xsd/sxbuiltin.py rename to asyncsuds/xsd/sxbuiltin.py index 9d0c1254..26c902df 100644 --- a/suds/xsd/sxbuiltin.py +++ b/asyncsuds/xsd/sxbuiltin.py @@ -17,10 +17,10 @@ """Classes representing I{built-in} XSD schema objects.""" -from suds import * -from suds.xsd import * -from suds.sax.date import * -from suds.xsd.sxbase import XBuiltin +from asyncsuds import * +from asyncsuds.xsd import * +from asyncsuds.sax.date import * +from asyncsuds.xsd.sxbase import XBuiltin import datetime import decimal diff --git a/setup.py b/setup.py index 8abea0db..1886b0d4 100644 --- a/setup.py +++ b/setup.py @@ -40,39 +40,17 @@ """ import sys -if sys.version_info < (2, 4): - print("ERROR: Python 2.4+ required") - sys.exit(-2) -if (3,) <= sys.version_info < (3, 1): - print("ERROR: Python 3.0 not supported - please use Python 3.1+ instead") +if sys.version_info < (3, 3): + print("ERROR: Python 3.3+ required") sys.exit(-2) + import os import os.path import re -# Workaround for a Python issue detected with Python 3.1.3 when running our -# pytest based 'setup.py test' command. At the end of the test run, Python -# would report an error: -# -# > Error in atexit._run_exitfuncs: -# > TypeError: print_exception(): Exception expected for value, str found -# -# Workaround found suggested by Richard Oudkerk in Python's issue tracker at: -# http://bugs.python.org/issue15881#msg170215 -# -# The error is caused by two chained Python bugs: -# 1. The multiprocessing module seems to call its global cleanup function only -# after all of its globals have already been released, thus raising an -# exception. -# 2. atexit exception handling implementation is not prepared to handle and -# correctly report the exception as raised by the multiprocessing module -# cleanup. -if (3,) <= sys.version_info < (3, 2): - import multiprocessing - del multiprocessing - +__version__ = 1 # ----------------------------------------------------------------------------- # Global variables. # ----------------------------------------------------------------------------- @@ -119,11 +97,8 @@ tools_folder = os.path.join(script_folder, "tools") sys.path.insert(0, tools_folder) -import suds_devel sys.path.pop(0) -from suds_devel.requirements import (check_Python24_pytest_requirements, - pytest_requirements, six_requirements) # ----------------------------------------------------------------------------- @@ -252,47 +227,6 @@ def import_setuptools_setup(): setup = import_setuptools_setup() if setup or not attempt_to_install_setuptools: return setup - if (3,) <= sys.version_info[:2] < (3, 2): - # Setuptools contains a test module with an explicitly specified UTF-8 - # BOM, which is not supported by Python's py2to3 tool prior to Python - # 3.2 (see Python issue #7313). Setuptools can still be installed - # manually using its ez_setup.py installer script (it will report and - # ignore the error), but if we use the ez_setup.use_setuptools() - # programmatic setup invocation from here - it will fail. - # - # There are several things that could be done here - patches welcome if - # anyone actually needs them: - # - the issue could be worked around by running the setuptools - # installation as a separate process in this case - # - warning display could be more cleanly integrated into distutils - # command execution process so the warning does not get displayed - # if setuptools would not actually be useful, e.g. if user just ran - # our setup script with no command or with the --help option - print("---") - print("WARNING: can not install setuptools automatically using Python " - "3.0 & 3.1") - print("WARNING: if needed, install setuptools manually before running " - "this installation using Python prior to version 3.2") - print("---") - return - import suds_devel.ez_setup_versioned - ez_setup = suds_devel.ez_setup_versioned.import_module() - try: - # Since we know there is no setuptools package in the current - # environment, this will: - # 1. download a setuptools source distribution to the current folder - # 2. prepare an installable setuptools egg distribution in the current - # folder - # 3. schedule for the prepared setuptools distribution to be installed - # together with our package (if our package is getting installed at - # all and setup has not been called for some other purpose, e.g. - # displaying its help information or running a non-install related - # setup command) - ez_setup.use_setuptools() - except (KeyboardInterrupt, SystemExit): - raise - except Exception: - return return import_setuptools_setup() setup = acquire_setuptools_setup() @@ -433,45 +367,6 @@ def test_requirements(): include_pytest_requirements = True - if sys.version_info < (2, 5): - # pytest requirements can not be installed automatically by this setup - # script under Python 2.4.x environment. Specific pytest & py library - # package version combination that we found working in Python 2.4.x - # environments does not formally satisfy pytest requirements, and we - # found no way to make setuptools' test command succeed when this - # script installs packages that do not have all their formal - # requirements satisfied. - have_pytest, have_py = check_Python24_pytest_requirements() - if not have_pytest: - return "compatible preinstalled pytest needed prior to Python 2.5" - if not have_py: - return "compatible preinstalled py needed prior to Python 2.5" - - # We must not explicitly specify pytest requirements when running the - # tests using a Python 2.4.x environment as the only way we found we - # can run our tests there is to use formally incompatible pytest & py - # packages. Explicitly specifying pytest requirements here would then - # cause setuptols to verify those requirements prior to running our - # test suite. - include_pytest_requirements = False - - if ((3,) <= sys.version_info < (3, 2, 3)): - # Python 3.x versions prior to Python 3.2.3 have a bug in their inspect - # module causing inspect.getmodule() calls to fail if some module lazy - # loads other modules when some of its attributes are accessed. For - # more detailed information see Python development issue #13487 - # (http://bugs.python.org/issue13487). - # - # This occurs when using setuptools to install our project into a - # Python 3.1 environment. There the py.error module seems to do such - # lazy loading. Forcing that module to be loaded here, before the - # setuptools installation procedure, avoids the issue. - try: - import py.error - py.error.__attribute_access_to_force_this_module_to_lazy_load__ - except (AttributeError, ImportError): - pass - # When using Python 2.5 on Windows, if setuptools chooses to install the # colorama package (pytest requirement on Windows) older than version # 0.1.11, running our 'setup.py test' command may show benign error @@ -481,9 +376,6 @@ def test_requirements(): # test' command that is installing it. The issue has been fixed by the next # Python 2.5 compatible colorama 0.3.2 release. result = [] - if include_pytest_requirements: - result.extend(pytest_requirements()) - result.extend(six_requirements()) return result test_error = None @@ -569,9 +461,8 @@ def _test_cmd_string(self): # Mark the original suds project as obsolete. # ----------------------------------------------------------------------------- -if sys.version_info >= (2, 5): - # distutils.setup() 'obsoletes' parameter not introduced until Python 2.5. - extra_setup_params["obsoletes"] = ["suds"] +# distutils.setup() 'obsoletes' parameter not introduced until Python 2.5. +extra_setup_params["obsoletes"] = ["suds"] # ----------------------------------------------------------------------------- @@ -624,39 +515,11 @@ def _test_cmd_string(self): # gave it our best. Continue on with possible spurious warnings. pass - -# ----------------------------------------------------------------------------- -# Set up project metadata and run the actual setup. -# ----------------------------------------------------------------------------- -# Package meta-data needs may be specified as: -# * Python 2.x - UTF-8 encoded bytes -# * Python [2.6, 3.0> - unicode string -# - unicode strings containing non-ASCII characters supported since Python -# commit 4c683ec4415b3c4bfbc7fe7a836b949cb7beea03 -# * Python [3.0, 3.2.2> -# - may only contain ASCII characters due to a distutils bug (given input -# can only be a unicode string and is encoded using the user's default -# system code-page, e.g. typically CP1250 on eastern European Windows, -# CP1252 on western European Windows, UTF-8 on Linux or any other) -# - setuptools 3.5 works around the issue by overriding relevant distutils -# functionality, allowing the use of non-ASCII characters, but only for -# Python 3.1 -# * Python 3.2.2+ - unicode string -# - unicode strings containing non-ASCII characters supported since Python -# commit fb4d2e6d393e96baac13c4efc216e361bf12c293 - -can_not_use_non_ASCII_meta_data = (3,) <= sys.version_info < (3, 2, 2) -if (can_not_use_non_ASCII_meta_data and using_setuptools and - sys.version_info[:2] == (3, 1)): - from setuptools import __version__ as setuptools_version - from pkg_resources import parse_version as pv - can_not_use_non_ASCII_meta_data = pv(setuptools_version) < pv("3.5") - # Wrap long_description at 72 characters since the PKG-INFO package # distribution metadata file stores this text with an 8 space indentation. long_description = """ --------------------------------------- -Lightweight SOAP client (Jurko's fork). +Lightweight SOAP client (Kamyar's fork). --------------------------------------- Based on the original 'suds' project by Jeff Ortel (jortel at redhat @@ -673,21 +536,19 @@ def _test_cmd_string(self): """ -package_name = "suds-jurko" +package_name = "async-suds" version_tag = safe_version(__version__) -project_url = "http://bitbucket.org/jurko/suds" +project_url = "http://bitbucket.org/kamyar1979/async-suds" base_download_url = project_url + "/downloads" download_distribution_name = "%s-%s.tar.bz2" % (package_name, version_tag) download_url = "%s/%s" % (base_download_url, download_distribution_name) -maintainer="Jurko Gospodnetić" -if can_not_use_non_ASCII_meta_data: - maintainer = unicode2ascii(maintainer) +maintainer="Kamyar Inanloo" setup( name=package_name, version=__version__, - description="Lightweight SOAP client (Jurko's fork)", + description="Lightweight async SOAP client (Kamyar's fork)", long_description=long_description, keywords=["SOAP", "web", "service", "client"], url=project_url, @@ -697,7 +558,7 @@ def _test_cmd_string(self): author="Jeff Ortel", author_email="jortel@redhat.com", maintainer=maintainer, - maintainer_email="jurko.gospodnetic@pke.hr", + maintainer_email="kamyar1979@gmail.com", # See PEP-301 for the classifier specification. For a complete list of # available classifiers see @@ -709,14 +570,6 @@ def _test_cmd_string(self): "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.4", - "Programming Language :: Python :: 2.5", - "Programming Language :: Python :: 2.6", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.1", - "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Internet"], diff --git a/suds/sax/__init__.py b/suds/sax/__init__.py deleted file mode 100644 index f4791dd9..00000000 --- a/suds/sax/__init__.py +++ /dev/null @@ -1,106 +0,0 @@ -# This program is free software; you can redistribute it and/or modify -# it under the terms of the (LGPL) GNU Lesser General Public License as -# published by the Free Software Foundation; either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Library Lesser General Public License for more details at -# ( http://www.gnu.org/licenses/lgpl.html ). -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# written by: Jeff Ortel ( jortel@redhat.com ) - -""" -The sax module contains a collection of classes that provide a (D)ocument -(O)bject (M)odel representation of an XML document. The goal is to provide an -easy, intuitive interface for managing XML documents. Although, the term, DOM, -is used above, this model is B{far} better. - -XML namespaces in suds are represented using a (2) element tuple containing the -prefix and the URI, e.g. I{('tns', 'http://myns')} - -@var encoder: A I{pluggable} XML special character processor used to encode/ - decode strings. -@type encoder: L{Encoder} -""" - -from suds.sax.enc import Encoder - -# -# pluggable XML special character encoder. -# -encoder = Encoder() - - -def splitPrefix(name): - """ - Split the name into a tuple (I{prefix}, I{name}). The first element in the - tuple is I{None} when the name does not have a prefix. - @param name: A node name containing an optional prefix. - @type name: basestring - @return: A tuple containing the (2) parts of I{name} - @rtype: (I{prefix}, I{name}) - """ - if isinstance(name, str) and ':' in name: - return tuple(name.split(':', 1)) - return None, name - - -class Namespace: - """ - The namespace class represents XML namespaces. - """ - - default = (None, None) - xmlns = ('xml', 'http://www.w3.org/XML/1998/namespace') - xsdns = ('xs', 'http://www.w3.org/2001/XMLSchema') - xsins = ('xsi', 'http://www.w3.org/2001/XMLSchema-instance') - all = (xsdns, xsins) - - @classmethod - def create(cls, p=None, u=None): - return p, u - - @classmethod - def none(cls, ns): - return ns == cls.default - - @classmethod - def xsd(cls, ns): - try: - return cls.w3(ns) and ns[1].endswith('XMLSchema') - except Exception: - pass - return False - - @classmethod - def xsi(cls, ns): - try: - return cls.w3(ns) and ns[1].endswith('XMLSchema-instance') - except Exception: - pass - return False - - @classmethod - def xs(cls, ns): - return cls.xsd(ns) or cls.xsi(ns) - - @classmethod - def w3(cls, ns): - try: - return ns[1].startswith('http://www.w3.org') - except Exception: - pass - return False - - @classmethod - def isns(cls, ns): - try: - return isinstance(ns, tuple) and len(ns) == len(cls.default) - except Exception: - pass - return False diff --git a/test.py b/test.py index 0a4d7342..ca5eb4bc 100644 --- a/test.py +++ b/test.py @@ -1,7 +1,7 @@ __author__ = 'kamyar' import asyncio -from suds.client import Client +from asyncsuds.client import Client import logging diff --git a/tests/external/axis1.py b/tests/external/axis1.py index d316be9d..4bbbf412 100644 --- a/tests/external/axis1.py +++ b/tests/external/axis1.py @@ -20,11 +20,11 @@ import sys sys.path.append('../../') -from suds import WebFault -from suds.client import Client -from suds.sudsobject import Object -from suds.transport.https import HttpAuthenticated -from suds.plugin import * +from asyncsuds import WebFault +from asyncsuds.client import Client +from asyncsuds.sudsobject import Object +from asyncsuds.transport.https import HttpAuthenticated +from asyncsuds.plugin import * import traceback as tb diff --git a/tests/external/axis2.py b/tests/external/axis2.py index 88fb43e6..5d2ba916 100644 --- a/tests/external/axis2.py +++ b/tests/external/axis2.py @@ -16,8 +16,8 @@ import sys sys.path.append('../../') -from suds import * -from suds.client import Client +from asyncsuds import * +from asyncsuds.client import Client from datetime import datetime diff --git a/tests/external/jasper.py b/tests/external/jasper.py index 301a6b2a..4af14d03 100644 --- a/tests/external/jasper.py +++ b/tests/external/jasper.py @@ -16,8 +16,8 @@ import sys sys.path.append('../../') -from suds import WebFault -from suds.client import Client +from asyncsuds import WebFault +from asyncsuds.client import Client import traceback as tb diff --git a/tests/external/public.py b/tests/external/public.py index d39a0c9a..b34dbb6e 100644 --- a/tests/external/public.py +++ b/tests/external/public.py @@ -17,9 +17,9 @@ sys.path.append('../../') import traceback as tb -import suds.metrics as metrics -from suds import WebFault -from suds.client import Client +import asyncsuds.metrics as metrics +from asyncsuds import WebFault +from asyncsuds.client import Client errors = 0 diff --git a/tests/external/rhq.py b/tests/external/rhq.py index 8f2dd22a..cbeaa040 100644 --- a/tests/external/rhq.py +++ b/tests/external/rhq.py @@ -21,8 +21,8 @@ import sys sys.path.append('../../') -from suds import WebFault -from suds.client import Client +from asyncsuds import WebFault +from asyncsuds.client import Client import traceback as tb diff --git a/tests/external/saxenc.py b/tests/external/saxenc.py index 1bb351c4..eecb7524 100644 --- a/tests/external/saxenc.py +++ b/tests/external/saxenc.py @@ -18,8 +18,8 @@ # sax encoding/decoding test. # -from suds.sax.element import Element -from suds.sax.parser import Parser +from asyncsuds.sax.element import Element +from asyncsuds.sax.parser import Parser def basic(): xml = "Me && <b>my</b> shadow's <i>dog</i> love to 'play' and sing "la,la,la";" diff --git a/tests/profiling/profile_sax_encoder.py b/tests/profiling/profile_sax_encoder.py index 29b7aa99..7bdd5f75 100644 --- a/tests/profiling/profile_sax_encoder.py +++ b/tests/profiling/profile_sax_encoder.py @@ -20,7 +20,7 @@ """ -import suds.sax.enc +import asyncsuds.sax.enc import tests.profiling import sys @@ -54,10 +54,10 @@ def __init__(self, long_input, replacements, cdata, print(" decode input data length: %d" % (len(self.decode_input),)) def decode(self): - suds.sax.enc.Encoder().decode(self.decode_input) + asyncsuds.sax.enc.Encoder().decode(self.decode_input) def encode(self): - suds.sax.enc.Encoder().encode(self.encode_input) + asyncsuds.sax.enc.Encoder().encode(self.encode_input) def __construct_input(self, long_input, replacements, cdata, encoded): """Construct profiling input data matching the given parameters.""" diff --git a/tests/test_argument_parser.py b/tests/test_argument_parser.py index 64a5778c..dc361196 100644 --- a/tests/test_argument_parser.py +++ b/tests/test_argument_parser.py @@ -31,8 +31,8 @@ if __name__ == "__main__": testutils.run_using_pytest(globals()) -import suds -import suds.argparser +import asyncsuds +import asyncsuds.argparser import pytest @@ -107,9 +107,9 @@ class MyException(Exception): pass def raise_exception(*args, **kwargs): raise MyException - monkeypatch.setattr(suds.argparser._ArgParser, "__init__", raise_exception) + monkeypatch.setattr(asyncsuds.argparser._ArgParser, "__init__", raise_exception) - wsdl = suds.byte_str("""\ + wsdl = asyncsuds.byte_str("""\ @@ -407,14 +407,14 @@ def construct_XML(element_name="Elemento"): """ % (element_name,)) - xml = suds.sax.parser.Parser().parse(suds.BytesIO(content)) - assert xml.__class__ is suds.sax.document.Document + xml = asyncsuds.sax.parser.Parser().parse(asyncsuds.BytesIO(content)) + assert xml.__class__ is asyncsuds.sax.document.Document return content, xml def test_cache_document(self, tmpdir): cache_item_id = "unga1" - cache = suds.cache.DocumentCache(tmpdir.strpath) - assert isinstance(cache, suds.cache.FileCache) + cache = asyncsuds.cache.DocumentCache(tmpdir.strpath) + assert isinstance(cache, asyncsuds.cache.FileCache) assert cache.get(cache_item_id) is None content, document = self.construct_XML() cache.put(cache_item_id, document) @@ -422,8 +422,8 @@ def test_cache_document(self, tmpdir): def test_cache_element(self, tmpdir): cache_item_id = "unga1" - cache = suds.cache.DocumentCache(tmpdir.strpath) - assert isinstance(cache, suds.cache.FileCache) + cache = asyncsuds.cache.DocumentCache(tmpdir.strpath) + assert isinstance(cache, asyncsuds.cache.FileCache) assert cache.get(cache_item_id) is None content, document = self.construct_XML() cache.put(cache_item_id, document.root()) @@ -438,7 +438,7 @@ def test_file_open_failure(self, tmpdir, monkeypatch): mock_open = MockFileOpener(fail_open=True) cache_folder = tmpdir.strpath - cache = suds.cache.DocumentCache(cache_folder) + cache = asyncsuds.cache.DocumentCache(cache_folder) content1, document1 = self.construct_XML("One") content2, document2 = self.construct_XML("Two") assert content1 != content2 @@ -488,7 +488,7 @@ def test_file_operation_failure(self, tmpdir, monkeypatch, mock, """ cache_folder = tmpdir.strpath - cache = suds.cache.DocumentCache(cache_folder) + cache = asyncsuds.cache.DocumentCache(cache_folder) content1, document1 = self.construct_XML("Eins") content2, document2 = self.construct_XML("Zwei") cache.put("unga1", document1) @@ -526,14 +526,14 @@ def test_file_operation_failure(self, tmpdir, monkeypatch, mock, def test_item_expiration(self, tmpdir, monkeypatch, duration, current_time, expect_remove): """See TestFileCache.item_expiration_test_worker() for more info.""" - cache = suds.cache.DocumentCache(tmpdir.strpath, **duration) + cache = asyncsuds.cache.DocumentCache(tmpdir.strpath, **duration) content, document = self.construct_XML() cache.put("willy", document) TestFileCache.item_expiration_test_worker(cache, "willy", monkeypatch, current_time, expect_remove) def test_repeated_reads(self, tmpdir): - cache = suds.cache.DocumentCache(tmpdir.strpath) + cache = asyncsuds.cache.DocumentCache(tmpdir.strpath) content, document = self.construct_XML() cache.put("unga1", document) read_XML = cache.get("unga1").str() @@ -571,7 +571,7 @@ def item_expiration_test_worker(cache, id, monkeypatch, current_time, the test file's expected expiration time. """ - assert isinstance(cache, suds.cache.FileCache) + assert isinstance(cache, asyncsuds.cache.FileCache) filepath = cache._FileCache__filename(id) assert os.path.isfile(filepath) file_timestamp = os.path.getctime(filepath) @@ -593,27 +593,27 @@ def item_expiration_test_worker(cache, id, monkeypatch, current_time, assert os.path.isfile(filepath) == (not expect_remove) def test_basic_construction(self): - cache = suds.cache.FileCache() - assert isinstance(cache, suds.cache.Cache) + cache = asyncsuds.cache.FileCache() + assert isinstance(cache, asyncsuds.cache.Cache) assert cache.duration.__class__ is datetime.timedelta def test_cached_content_empty(self, tmpdir): cache_folder = tmpdir.strpath - cache = suds.cache.FileCache(cache_folder) + cache = asyncsuds.cache.FileCache(cache_folder) cache.put("unga1", value_empty) assert cache.get("unga1") == value_empty _assert_empty_cache_folder(cache_folder, expected=False) def test_cached_content_unicode(self, tmpdir): cache_folder = tmpdir.strpath - cache = suds.cache.FileCache(cache_folder) + cache = asyncsuds.cache.FileCache(cache_folder) cache.put("unga1", value_unicode) assert cache.get("unga1") == value_unicode _assert_empty_cache_folder(cache_folder, expected=False) def test_clear(self, tmpdir): cache_folder1 = tmpdir.join("fungus").strpath - cache1 = suds.cache.FileCache(cache_folder1) + cache1 = asyncsuds.cache.FileCache(cache_folder1) cache1.put("unga1", value_p1) _assert_empty_cache_folder(cache_folder1, expected=False) cache1.put("unga2", value_p2) @@ -634,7 +634,7 @@ def test_clear(self, tmpdir): _assert_empty_cache_folder(cache_folder1, expected=False) cache_folder2 = tmpdir.join("broccoli").strpath - cache2 = suds.cache.FileCache(cache_folder2) + cache2 = asyncsuds.cache.FileCache(cache_folder2) cache2.put("unga2", value_f2) assert cache2.get("unga2") == value_f2 assert cache1.get("unga2") == value_p2 @@ -649,18 +649,18 @@ def test_clear(self, tmpdir): def test_close_leaves_cached_files_behind(self, tmpdir): cache_folder1 = tmpdir.join("ana").strpath - cache1 = suds.cache.FileCache(cache_folder1) + cache1 = asyncsuds.cache.FileCache(cache_folder1) cache1.put("unga1", value_p1) cache1.put("unga2", value_p2) cache_folder2 = tmpdir.join("nan").strpath - cache2 = suds.cache.FileCache(cache_folder2) + cache2 = asyncsuds.cache.FileCache(cache_folder2) cache2.put("unga2", value_f2) cache2.put("unga3", value_f3) del cache1 - cache11 = suds.cache.FileCache(cache_folder1) + cache11 = asyncsuds.cache.FileCache(cache_folder1) assert cache11.get("unga1") == value_p1 assert cache11.get("unga2") == value_p2 assert cache2.get("unga2") == value_f2 @@ -668,7 +668,7 @@ def test_close_leaves_cached_files_behind(self, tmpdir): def test_get_put(self, tmpdir): cache_folder1 = tmpdir.join("firefly").strpath - cache1 = suds.cache.FileCache(cache_folder1) + cache1 = asyncsuds.cache.FileCache(cache_folder1) _assert_empty_cache_folder(cache_folder1) assert cache1.get("unga1") is None cache1.put("unga1", value_p1) @@ -683,7 +683,7 @@ def test_get_put(self, tmpdir): assert cache1.get("unga2") == value_p2 cache_folder2 = tmpdir.join("semper fi").strpath - cache2 = suds.cache.FileCache(cache_folder2) + cache2 = asyncsuds.cache.FileCache(cache_folder2) _assert_empty_cache_folder(cache_folder2) assert cache2.get("unga2") is None cache2.put("unga2", value_f2) @@ -707,7 +707,7 @@ def test_get_put(self, tmpdir): assert cache2.get("unga3") == value_f3 def test_independent_item_expirations(self, tmpdir, monkeypatch): - cache = suds.cache.FileCache(tmpdir.strpath, days=1) + cache = asyncsuds.cache.FileCache(tmpdir.strpath, days=1) cache.put("unga1", value_p1) cache.put("unga2", value_p2) cache.put("unga3", value_f2) @@ -760,13 +760,13 @@ def mock_getctime(path): def test_item_expiration(self, tmpdir, monkeypatch, duration, current_time, expect_remove): """See TestFileCache.item_expiration_test_worker() for more info.""" - cache = suds.cache.FileCache(tmpdir.strpath, **duration) + cache = asyncsuds.cache.FileCache(tmpdir.strpath, **duration) cache.put("unga1", value_p1) TestFileCache.item_expiration_test_worker(cache, "unga1", monkeypatch, current_time, expect_remove) def test_non_default_location(self, tmpdir): - FileCache = suds.cache.FileCache + FileCache = asyncsuds.cache.FileCache cache_folder1 = tmpdir.join("flip-flop1").strpath assert not os.path.isdir(cache_folder1) @@ -780,7 +780,7 @@ def test_non_default_location(self, tmpdir): def test_purge(self, tmpdir): cache_folder1 = tmpdir.join("flamenco").strpath - cache1 = suds.cache.FileCache(cache_folder1) + cache1 = asyncsuds.cache.FileCache(cache_folder1) cache1.put("unga1", value_p1) assert cache1.get("unga1") == value_p1 cache1.purge("unga1") @@ -796,7 +796,7 @@ def test_purge(self, tmpdir): cache1.put("unga1", value_p111) cache_folder2 = tmpdir.join("shadow").strpath - cache2 = suds.cache.FileCache(cache_folder2) + cache2 = asyncsuds.cache.FileCache(cache_folder2) cache2.put("unga2", value_f2) cache2.purge("unga2") _assert_empty_cache_folder(cache_folder2) @@ -806,7 +806,7 @@ def test_purge(self, tmpdir): def test_reused_cache_folder(self, tmpdir): cache_folder = tmpdir.strpath - cache1 = suds.cache.FileCache(cache_folder) + cache1 = asyncsuds.cache.FileCache(cache_folder) _assert_empty_cache_folder(cache_folder) assert cache1.get("unga1") is None cache1.put("unga1", value_p1) @@ -819,7 +819,7 @@ def test_reused_cache_folder(self, tmpdir): assert cache1.get("unga1") == value_p11 assert cache1.get("unga2") == value_p2 - cache2 = suds.cache.FileCache(cache_folder) + cache2 = asyncsuds.cache.FileCache(cache_folder) assert cache2.get("unga1") == value_p11 assert cache2.get("unga2") == value_p2 cache2.put("unga2", value_f2) @@ -850,27 +850,27 @@ def test_reused_cache_folder(self, tmpdir): {"weeks": -1}, {"weeks": 1, "days": 2, "hours": 7, "minutes": 0, "seconds": -712})) def test_set_durations(self, tmpdir, params): - cache = suds.cache.FileCache(tmpdir.strpath, **params) + cache = asyncsuds.cache.FileCache(tmpdir.strpath, **params) assert cache.duration == datetime.timedelta(**params) def test_version(self, tmpdir): fake_version_info = "--- fake version info ---" - assert suds.__version__ != fake_version_info + assert asyncsuds.__version__ != fake_version_info version_file = tmpdir.join("version") cache_folder = tmpdir.strpath - cache = suds.cache.FileCache(cache_folder) - assert version_file.read() == suds.__version__ + cache = asyncsuds.cache.FileCache(cache_folder) + assert version_file.read() == asyncsuds.__version__ cache.put("unga1", value_p1) version_file.write(fake_version_info) assert cache.get("unga1") == value_p1 - cache2 = suds.cache.FileCache(cache_folder) + cache2 = asyncsuds.cache.FileCache(cache_folder) _assert_empty_cache_folder(cache_folder) assert cache.get("unga1") is None assert cache2.get("unga1") is None - assert version_file.read() == suds.__version__ + assert version_file.read() == asyncsuds.__version__ cache.put("unga1", value_p11) cache.put("unga2", value_p22) @@ -878,18 +878,18 @@ def test_version(self, tmpdir): assert cache.get("unga1") == value_p11 assert cache.get("unga2") == value_p22 - cache3 = suds.cache.FileCache(cache_folder) + cache3 = asyncsuds.cache.FileCache(cache_folder) _assert_empty_cache_folder(cache_folder) assert cache.get("unga1") is None assert cache.get("unga2") is None assert cache2.get("unga1") is None assert cache3.get("unga1") is None - assert version_file.read() == suds.__version__ + assert version_file.read() == asyncsuds.__version__ def test_NoCache(monkeypatch): - cache = suds.cache.NoCache() - assert isinstance(cache, suds.cache.Cache) + cache = asyncsuds.cache.NoCache() + assert isinstance(cache, asyncsuds.cache.Cache) assert cache.get("id") == None cache.put("id", "something") @@ -913,8 +913,8 @@ def test_NoCache(monkeypatch): class TestObjectCache: def test_basic(self, tmpdir): - cache = suds.cache.ObjectCache(tmpdir.strpath) - assert isinstance(cache, suds.cache.FileCache) + cache = asyncsuds.cache.ObjectCache(tmpdir.strpath) + assert isinstance(cache, asyncsuds.cache.FileCache) assert cache.get("unga1") is None assert cache.get("unga2") is None cache.put("unga1", InvisibleMan(1)) @@ -935,7 +935,7 @@ def test_file_open_failure(self, tmpdir, monkeypatch): mock_open = MockFileOpener(fail_open=True) cache_folder = tmpdir.strpath - cache = suds.cache.ObjectCache(cache_folder) + cache = asyncsuds.cache.ObjectCache(cache_folder) cache.put("unga1", InvisibleMan(1)) mock_open.apply(monkeypatch) @@ -982,7 +982,7 @@ def test_file_operation_failure(self, tmpdir, monkeypatch, mock, """ cache_folder = tmpdir.strpath - cache = suds.cache.ObjectCache(cache_folder) + cache = asyncsuds.cache.ObjectCache(cache_folder) cache.put("unga1", InvisibleMan(1)) mock.apply(monkeypatch) @@ -1018,7 +1018,7 @@ def test_file_operation_failure(self, tmpdir, monkeypatch, mock, def test_item_expiration(self, tmpdir, monkeypatch, duration, current_time, expect_remove): """See TestFileCache.item_expiration_test_worker() for more info.""" - cache = suds.cache.ObjectCache(tmpdir.strpath, **duration) + cache = asyncsuds.cache.ObjectCache(tmpdir.strpath, **duration) cache.put("silly", InvisibleMan(666)) TestFileCache.item_expiration_test_worker(cache, "silly", monkeypatch, current_time, expect_remove) diff --git a/tests/test_client.py b/tests/test_client.py index df8986fd..3d895233 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -26,11 +26,11 @@ if __name__ == "__main__": testutils.run_using_pytest(globals()) -import suds -import suds.cache -import suds.store -import suds.transport -import suds.transport.https +import asyncsuds +import asyncsuds.cache +import asyncsuds.store +import asyncsuds.transport +import asyncsuds.transport.https import pytest from six import iteritems, itervalues, next @@ -42,7 +42,7 @@ class MyException(Exception): pass -class MockCache(suds.cache.Cache): +class MockCache(asyncsuds.cache.Cache): """ Mock cache structure used in the tests in this module. @@ -86,7 +86,7 @@ def put(self, id, object): assert self.mock_put_config == MockCache.IGNORE -class MockDocumentStore(suds.store.DocumentStore): +class MockDocumentStore(asyncsuds.store.DocumentStore): """Mock DocumentStore tracking all of its operations.""" def __init__(self, *args, **kwargs): @@ -104,7 +104,7 @@ def reset(self): self.mock_log = [] -class MockTransport(suds.transport.Transport): +class MockTransport(asyncsuds.transport.Transport): """ Mock Transport used by the tests implemented in this module. @@ -139,7 +139,7 @@ def open(self, request): if not self.mock_open_data: pytest.fail("Unexpected MockTransport.open() operation call.") result = self.__next_operation_result(self.mock_open_data) - return suds.BytesIO(result) + return asyncsuds.BytesIO(result) def send(self, request): self.mock_log.append(("send", [request.url, request.message])) @@ -148,7 +148,7 @@ def send(self, request): status = http_client.OK headers = {} data = self.__next_operation_result(self.mock_send_data) - return suds.transport.Reply(status, headers, data) + return asyncsuds.transport.Reply(status, headers, data) @staticmethod def __next_operation_result(data_list): @@ -157,7 +157,7 @@ def __next_operation_result(data_list): raise value if value.__class__ is type and issubclass(value, Exception): raise value() - assert value.__class__ is suds.byte_str_class, "bad test data" + assert value.__class__ is asyncsuds.byte_str_class, "bad test data" return value @@ -243,24 +243,24 @@ def test_avoid_imported_WSDL_fetching(self): # Prepare data. url_imported = "suds://wsdl_imported" wsdl_import_wrapper = wsdl_import_wrapper_format % (url_imported,) - wsdl_import_wrapper = suds.byte_str(wsdl_import_wrapper) - wsdl_imported = suds.byte_str(wsdl_imported_format % ("",)) + wsdl_import_wrapper = asyncsuds.byte_str(wsdl_import_wrapper) + wsdl_imported = asyncsuds.byte_str(wsdl_imported_format % ("",)) # Add to cache. cache = MockCache() store1 = MockDocumentStore(wsdl=wsdl_import_wrapper, wsdl_imported=wsdl_imported) - c1 = suds.client.Client("suds://wsdl", cachingpolicy=1, + c1 = asyncsuds.client.Client("suds://wsdl", cachingpolicy=1, cache=cache, documentStore=store1, transport=MockTransport()) assert store1.mock_log == ["suds://wsdl", "suds://wsdl_imported"] assert len(cache.mock_data) == 1 wsdl_object_id, wsdl_object = next(iteritems(cache.mock_data)) - assert wsdl_object.__class__ is suds.wsdl.Definitions + assert wsdl_object.__class__ is asyncsuds.wsdl.Definitions # Reuse from cache. cache.mock_log = [] store2 = MockDocumentStore(wsdl=wsdl_import_wrapper) - c2 = suds.client.Client("suds://wsdl", cachingpolicy=1, + c2 = asyncsuds.client.Client("suds://wsdl", cachingpolicy=1, cache=cache, documentStore=store2, transport=MockTransport()) assert cache.mock_log == [("get", [wsdl_object_id])] assert store2.mock_log == [] @@ -277,25 +277,25 @@ def test_avoid_external_XSD_fetching(self): """ - external_xsd1 = suds.byte_str(external_xsd_format % (1,)) - external_xsd2 = suds.byte_str(external_xsd_format % (2,)) + external_xsd1 = asyncsuds.byte_str(external_xsd_format % (1,)) + external_xsd2 = asyncsuds.byte_str(external_xsd_format % (2,)) # Add to cache. cache = MockCache() store1 = MockDocumentStore(wsdl=wsdl, imported_xsd=external_xsd1, included_xsd=external_xsd2) - c1 = suds.client.Client("suds://wsdl", cachingpolicy=1, + c1 = asyncsuds.client.Client("suds://wsdl", cachingpolicy=1, cache=cache, documentStore=store1, transport=MockTransport()) assert store1.mock_log == ["suds://wsdl", "suds://imported_xsd", "suds://included_xsd"] assert len(cache.mock_data) == 1 wsdl_object_id, wsdl_object = next(iteritems(cache.mock_data)) - assert wsdl_object.__class__ is suds.wsdl.Definitions + assert wsdl_object.__class__ is asyncsuds.wsdl.Definitions # Reuse from cache. cache.mock_log = [] store2 = MockDocumentStore(wsdl=wsdl) - c2 = suds.client.Client("suds://wsdl", cachingpolicy=1, + c2 = asyncsuds.client.Client("suds://wsdl", cachingpolicy=1, cache=cache, documentStore=store2, transport=MockTransport()) assert cache.mock_log == [("get", [wsdl_object_id])] assert store2.mock_log == [] @@ -320,8 +320,8 @@ def test_importing_WSDL_from_cache_avoids_store_avoids_transport(self, # Prepare test data. url_imported = "suds://wsdl_imported" wsdl_import_wrapper = wsdl_import_wrapper_format % (url_imported,) - wsdl_import_wrapper = suds.byte_str(wsdl_import_wrapper) - wsdl_imported = suds.byte_str(wsdl_imported_format % ( + wsdl_import_wrapper = asyncsuds.byte_str(wsdl_import_wrapper) + wsdl_imported = asyncsuds.byte_str(wsdl_imported_format % ( '',)) wsdl_imported_element_id = ("Pistachio", wsdl_imported_xsd_namespace) @@ -331,7 +331,7 @@ def test_importing_WSDL_from_cache_avoids_store_avoids_transport(self, cache = MockCache() store1 = MockDocumentStore(wsdl=wsdl_import_wrapper, wsdl_imported=wsdl_imported) - c1 = suds.client.Client("suds://wsdl", cachingpolicy=0, cache=cache, + c1 = asyncsuds.client.Client("suds://wsdl", cachingpolicy=0, cache=cache, documentStore=store1, transport=MockTransport()) assert [x for x, y in cache.mock_log] == ["get", "put"] * 2 id_wsdl = cache.mock_log[0][1][0] @@ -359,7 +359,7 @@ def test_importing_WSDL_from_cache_avoids_store_avoids_transport(self, del cache.mock_data[id_wsdl] assert len(cache.mock_data) == 1 store2 = MockDocumentStore(wsdl=wsdl_import_wrapper) - c2 = suds.client.Client("suds://wsdl", cachingpolicy=0, cache=cache, + c2 = asyncsuds.client.Client("suds://wsdl", cachingpolicy=0, cache=cache, documentStore=store2, transport=MockTransport()) expected_cache_operations = [("get", id_wsdl)] if not importing_WSDL_cached: @@ -392,7 +392,7 @@ def test_using_cached_WSDL_avoids_store_avoids_transport(self, # store and not fetched using the client's registered transport. cache = MockCache() store1 = MockDocumentStore(umpala=testutils.wsdl("")) - c1 = suds.client.Client("suds://umpala", cachingpolicy=caching_policy, + c1 = asyncsuds.client.Client("suds://umpala", cachingpolicy=caching_policy, cache=cache, documentStore=store1, transport=MockTransport()) assert [x for x, y in cache.mock_log] == ["get", "put"] id = cache.mock_log[0][1][0] @@ -401,12 +401,12 @@ def test_using_cached_WSDL_avoids_store_avoids_transport(self, if caching_policy == 0: # Cache contains SAX XML documents. wsdl_document = next(itervalues(cache.mock_data)) - assert wsdl_document.__class__ is suds.sax.document.Document + assert wsdl_document.__class__ is asyncsuds.sax.document.Document wsdl_cached_root = wsdl_document.root() else: # Cache contains complete suds WSDL objects. wsdl = next(itervalues(cache.mock_data)) - assert wsdl.__class__ is suds.wsdl.Definitions + assert wsdl.__class__ is asyncsuds.wsdl.Definitions wsdl_cached_root = wsdl.root assert c1.wsdl.root is wsdl_cached_root @@ -415,7 +415,7 @@ def test_using_cached_WSDL_avoids_store_avoids_transport(self, cache.mock_log = [] cache.mock_put_config = MockCache.FAIL store2 = MockDocumentStore(mock_fail=True) - c2 = suds.client.Client("suds://umpala", cachingpolicy=caching_policy, + c2 = asyncsuds.client.Client("suds://umpala", cachingpolicy=caching_policy, cache=cache, documentStore=store2, transport=MockTransport()) assert cache.mock_log == [("get", [id])] assert c2.wsdl.root is wsdl_cached_root @@ -443,7 +443,7 @@ def test_using_cached_XSD_schema_avoids_store_avoids_transport(self, wsdl = testutils.wsdl('' % ( external_reference_tag,), xsd_target_namespace=xsd_target_namespace) - external_schema = suds.byte_str("""\ + external_schema = asyncsuds.byte_str("""\ @@ -460,7 +460,7 @@ def test_using_cached_XSD_schema_avoids_store_avoids_transport(self, # Add to cache. cache = MockCache() store1 = MockDocumentStore(wsdl=wsdl, external=external_schema) - c1 = suds.client.Client("suds://wsdl", cachingpolicy=0, cache=cache, + c1 = asyncsuds.client.Client("suds://wsdl", cachingpolicy=0, cache=cache, documentStore=store1, transport=MockTransport()) assert [x for x, y in cache.mock_log] == ["get", "put"] * 2 id_wsdl = cache.mock_log[0][1][0] @@ -491,7 +491,7 @@ def test_using_cached_XSD_schema_avoids_store_avoids_transport(self, del cache.mock_data[id_wsdl] assert len(cache.mock_data) == 1 store2 = MockDocumentStore(wsdl=wsdl) - c2 = suds.client.Client("suds://wsdl", cachingpolicy=0, cache=cache, + c2 = asyncsuds.client.Client("suds://wsdl", cachingpolicy=0, cache=cache, documentStore=store2, transport=MockTransport()) expected_cache_operations = [("get", id_wsdl)] if not main_WSDL_cached: @@ -512,18 +512,18 @@ class TestCacheUsage: @pytest.mark.parametrize("cache", ( None, - suds.cache.NoCache(), - suds.cache.ObjectCache())) + asyncsuds.cache.NoCache(), + asyncsuds.cache.ObjectCache())) def test_avoiding_default_cache_construction(self, cache, monkeypatch): """Explicitly specified cache avoids default cache construction.""" def construct_default_cache(*args, **kwargs): pytest.fail("Unexpected default cache instantiation.") - class MockStore(suds.store.DocumentStore): + class MockStore(asyncsuds.store.DocumentStore): def open(self, *args, **kwargs): raise MyException - monkeypatch.setattr(suds.cache, "ObjectCache", construct_default_cache) - monkeypatch.setattr(suds.store, "DocumentStore", MockStore) - pytest.raises(MyException, suds.client.Client, "suds://some_URL", + monkeypatch.setattr(asyncsuds.cache, "ObjectCache", construct_default_cache) + monkeypatch.setattr(asyncsuds.store, "DocumentStore", MockStore) + pytest.raises(MyException, asyncsuds.client.Client, "suds://some_URL", documentStore=MockStore(), cache=cache) def test_default_cache_construction(self, monkeypatch): @@ -539,22 +539,22 @@ def test_default_cache_construction(self, monkeypatch): def construct_default_cache(days): assert days == 1 raise MyException - class MockStore(suds.store.DocumentStore): + class MockStore(asyncsuds.store.DocumentStore): def open(self, *args, **kwargs): pytest.fail("Default cache not created in time.") - monkeypatch.setattr(suds.cache, "ObjectCache", construct_default_cache) - monkeypatch.setattr(suds.store, "DocumentStore", MockStore) - pytest.raises(MyException, suds.client.Client, "suds://some_URL", + monkeypatch.setattr(asyncsuds.cache, "ObjectCache", construct_default_cache) + monkeypatch.setattr(asyncsuds.store, "DocumentStore", MockStore) + pytest.raises(MyException, asyncsuds.client.Client, "suds://some_URL", documentStore=MockStore()) @pytest.mark.parametrize("cache", (object(), MyException())) def test_reject_invalid_cache_class(self, cache, monkeypatch): monkeypatch.delitem(locals(), "e", False) - e = pytest.raises(AttributeError, suds.client.Client, + e = pytest.raises(AttributeError, asyncsuds.client.Client, "suds://some_URL", cache=cache).value try: expected_error = '"cache" must be: (%r,)' - assert str(e) == expected_error % (suds.cache.Cache,) + assert str(e) == expected_error % (asyncsuds.cache.Cache,) finally: del e # explicitly break circular reference chain in Python 3 @@ -562,14 +562,14 @@ def test_reject_invalid_cache_class(self, cache, monkeypatch): class TestStoreUsage: """suds.client.Client document store component usage tests.""" - @pytest.mark.parametrize("store", (object(), suds.cache.NoCache())) + @pytest.mark.parametrize("store", (object(), asyncsuds.cache.NoCache())) def test_reject_invalid_store_class(self, store, monkeypatch): monkeypatch.delitem(locals(), "e", False) - e = pytest.raises(AttributeError, suds.client.Client, + e = pytest.raises(AttributeError, asyncsuds.client.Client, "suds://some_URL", documentStore=store, cache=None).value try: expected_error = '"documentStore" must be: (%r,)' - assert str(e) == expected_error % (suds.store.DocumentStore,) + assert str(e) == expected_error % (asyncsuds.store.DocumentStore,) finally: del e # explicitly break circular reference chain in Python 3 @@ -579,16 +579,16 @@ class TestTransportUsage: def test_default_transport(self): client = testutils.client_from_wsdl(testutils.wsdl("")) - expected = suds.transport.https.HttpAuthenticated + expected = asyncsuds.transport.https.HttpAuthenticated assert client.options.transport.__class__ is expected @pytest.mark.parametrize("exception", ( MyException(), # non-TransportError exception - suds.transport.TransportError("huku", 666))) + asyncsuds.transport.TransportError("huku", 666))) def test_error_on_open(self, monkeypatch, exception): monkeypatch.delitem(locals(), "e_info", False) transport = MockTransport(open_data=exception) - e_info = pytest.raises(exception.__class__, suds.client.Client, "url", + e_info = pytest.raises(exception.__class__, asyncsuds.client.Client, "url", cache=None, transport=transport) try: assert e_info.value is exception @@ -599,7 +599,7 @@ def test_error_on_send__non_transport(self): e = MyException() t = MockTransport(send_data=e) store = MockDocumentStore(wsdl=testutils.wsdl("", operation_name="g")) - client = suds.client.Client("suds://wsdl", documentStore=store, + client = asyncsuds.client.Client("suds://wsdl", documentStore=store, cache=None, transport=t) assert pytest.raises(MyException, client.service.g).value is e @@ -616,9 +616,9 @@ def test_error_on_send__non_transport(self): # handled differently from other exception types. def test_error_on_send__transport(self, monkeypatch): monkeypatch.delitem(locals(), "e", False) - t = MockTransport(send_data=suds.transport.TransportError("huku", 666)) + t = MockTransport(send_data=asyncsuds.transport.TransportError("huku", 666)) store = MockDocumentStore(wsdl=testutils.wsdl("", operation_name="g")) - client = suds.client.Client("suds://wsdl", documentStore=store, + client = asyncsuds.client.Client("suds://wsdl", documentStore=store, cache=None, transport=t) e = pytest.raises(Exception, client.service.g).value try: @@ -637,20 +637,20 @@ def test_operation_request_and_reply(self): xsd_content = '' web_service_URL = "Great minds think alike" xsd_target_namespace = "omicron psi" - wsdl = testutils.wsdl(suds.byte_str(xsd_content), operation_name="pi", + wsdl = testutils.wsdl(asyncsuds.byte_str(xsd_content), operation_name="pi", xsd_target_namespace=xsd_target_namespace, input="Data", output="Data", web_service_URL=web_service_URL) test_input_data = "Riff-raff" test_output_data = "La-di-da-da-da" store = MockDocumentStore(wsdl=wsdl) - transport = MockTransport(send_data=suds.byte_str("""\ + transport = MockTransport(send_data=asyncsuds.byte_str("""\ %s """ % (xsd_target_namespace, test_output_data))) - client = suds.client.Client("suds://wsdl", documentStore=store, + client = asyncsuds.client.Client("suds://wsdl", documentStore=store, cache=None, transport=transport) assert transport.mock_log == [] reply = client.service.pi(test_input_data) @@ -658,18 +658,18 @@ def test_operation_request_and_reply(self): assert transport.mock_log[0][0] == "send" assert transport.mock_log[0][1][0] == web_service_URL request_message = transport.mock_log[0][1][1] - assert suds.byte_str(xsd_target_namespace) in request_message - assert suds.byte_str(test_input_data) in request_message + assert asyncsuds.byte_str(xsd_target_namespace) in request_message + assert asyncsuds.byte_str(test_input_data) in request_message assert reply == test_output_data - @pytest.mark.parametrize("transport", (object(), suds.cache.NoCache())) + @pytest.mark.parametrize("transport", (object(), asyncsuds.cache.NoCache())) def test_reject_invalid_transport_class(self, transport, monkeypatch): monkeypatch.delitem(locals(), "e", False) - e = pytest.raises(AttributeError, suds.client.Client, + e = pytest.raises(AttributeError, asyncsuds.client.Client, "suds://some_URL", transport=transport, cache=None).value try: expected_error = '"transport" must be: (%r,)' - assert str(e) == expected_error % (suds.transport.Transport,) + assert str(e) == expected_error % (asyncsuds.transport.Transport,) finally: del e # explicitly break circular reference chain in Python 3 @@ -677,16 +677,16 @@ def test_reject_invalid_transport_class(self, transport, monkeypatch): def test_WSDL_transport(self, url): store = MockDocumentStore() t = MockTransport(open_data=testutils.wsdl("")) - suds.client.Client(url, cache=None, documentStore=store, transport=t) + asyncsuds.client.Client(url, cache=None, documentStore=store, transport=t) assert t.mock_log == [("open", [url])] @pytest.mark.parametrize("url", test_URL_data) def test_imported_WSDL_transport(self, url): wsdl_import_wrapper = wsdl_import_wrapper_format % (url,) - wsdl_imported = suds.byte_str(wsdl_imported_format % ("",)) - store = MockDocumentStore(wsdl=suds.byte_str(wsdl_import_wrapper)) + wsdl_imported = asyncsuds.byte_str(wsdl_imported_format % ("",)) + store = MockDocumentStore(wsdl=asyncsuds.byte_str(wsdl_import_wrapper)) t = MockTransport(open_data=wsdl_imported) - suds.client.Client("suds://wsdl", cache=None, documentStore=store, + asyncsuds.client.Client("suds://wsdl", cache=None, documentStore=store, transport=t) assert t.mock_log == [("open", [url])] @@ -696,11 +696,11 @@ def test_external_XSD_transport(self, url, external_reference_tag): xsd_content = '' % dict( tag=external_reference_tag, url=url) store = MockDocumentStore(wsdl=testutils.wsdl(xsd_content)) - t = MockTransport(open_data=suds.byte_str("""\ + t = MockTransport(open_data=asyncsuds.byte_str("""\ """)) - suds.client.Client("suds://wsdl", cache=None, documentStore=store, + asyncsuds.client.Client("suds://wsdl", cache=None, documentStore=store, transport=t) assert t.mock_log == [("open", [url])] @@ -709,14 +709,14 @@ def test_external_XSD_transport(self, url, external_reference_tag): def test_WSDL_import(): wsdl_target_namespace = "bingo-bongo" wsdl = testutils.wsdl("", wsdl_target_namespace=wsdl_target_namespace) - wsdl_wrapper = suds.byte_str("""\ + wsdl_wrapper = asyncsuds.byte_str("""\ """ % {"tns": wsdl_target_namespace}) - store = suds.store.DocumentStore(wsdl=wsdl, wsdl_wrapper=wsdl_wrapper) - client = suds.client.Client("suds://wsdl_wrapper", documentStore=store, + store = asyncsuds.store.DocumentStore(wsdl=wsdl, wsdl_wrapper=wsdl_wrapper) + client = asyncsuds.client.Client("suds://wsdl_wrapper", documentStore=store, cache=None, nosend=True) client.service.f() #TODO: client.service is empty but other parts of client's imported WSDL diff --git a/tests/test_compare_sax.py b/tests/test_compare_sax.py index 3e9703ab..f56e604f 100644 --- a/tests/test_compare_sax.py +++ b/tests/test_compare_sax.py @@ -24,9 +24,9 @@ import testutils testutils.run_using_pytest(globals()) -import suds -import suds.sax.document -import suds.sax.parser +import asyncsuds +import asyncsuds.sax.document +import asyncsuds.sax.parser from testutils.assertion import assert_no_output from testutils.compare_sax import CompareSAX @@ -60,8 +60,8 @@ class TestMatched: @skip_test_if_CompareSAX_assertions_disabled def test_empty_document(self, capsys): - a = suds.sax.document.Document() - b = suds.sax.document.Document() + a = asyncsuds.sax.document.Document() + b = asyncsuds.sax.document.Document() CompareSAX.document2document(a, b) assert_no_output(capsys) @@ -85,8 +85,8 @@ def test_data2data(self, data1, data2, capsys): assert_no_output(capsys) @skip_test_if_CompareSAX_assertions_disabled - @pytest.mark.parametrize("type1", (suds.byte_str, text_type)) - @pytest.mark.parametrize("type2", (suds.byte_str, text_type)) + @pytest.mark.parametrize("type1", (asyncsuds.byte_str, text_type)) + @pytest.mark.parametrize("type2", (asyncsuds.byte_str, text_type)) def test_string_input_types(self, type1, type2, capsys): xml = "" CompareSAX.data2data(type1(xml), type2(xml)) @@ -158,45 +158,45 @@ def test_data2data(self, data1, data2, expected_context, capsys): @skip_test_if_CompareSAX_assertions_disabled def test_document2document_context(self, capsys): - a = suds.sax.document.Document() - b = suds.sax.parser.Parser().parse(string=suds.byte_str("")) + a = asyncsuds.sax.document.Document() + b = asyncsuds.sax.parser.Parser().parse(string=asyncsuds.byte_str("")) pytest.raises(AssertionError, CompareSAX.document2document, a, b) _assert_context_output(capsys, "document2document") @skip_test_if_CompareSAX_assertions_disabled def test_document2element_context(self, capsys): - a = suds.sax.parser.Parser().parse(string=suds.byte_str("1")) - b = suds.sax.parser.Parser().parse(string=suds.byte_str("2")) + a = asyncsuds.sax.parser.Parser().parse(string=asyncsuds.byte_str("1")) + b = asyncsuds.sax.parser.Parser().parse(string=asyncsuds.byte_str("2")) pytest.raises(AssertionError, CompareSAX.document2element, a, b.root()) _assert_context_output(capsys, "document2element..text") @skip_test_if_CompareSAX_assertions_disabled def test_element2element_context(self, capsys): - Parser = suds.sax.parser.Parser - e1 = Parser().parse(string=suds.byte_str("")).root() - e2 = Parser().parse(string=suds.byte_str("")).root() + Parser = asyncsuds.sax.parser.Parser + e1 = Parser().parse(string=asyncsuds.byte_str("")).root() + e2 = Parser().parse(string=asyncsuds.byte_str("")).root() pytest.raises(AssertionError, CompareSAX.element2element, e1, e2) _assert_context_output(capsys, "element2element.") @skip_test_if_CompareSAX_assertions_disabled def test_element2element_context_invalid_name__left(self, capsys): - Parser = suds.sax.parser.Parser - e = Parser().parse(string=suds.byte_str("")).root() + Parser = asyncsuds.sax.parser.Parser + e = Parser().parse(string=asyncsuds.byte_str("")).root() e_invalid = object() pytest.raises(AssertionError, CompareSAX.element2element, e_invalid, e) _assert_context_output(capsys, "element2element.") @skip_test_if_CompareSAX_assertions_disabled def test_element2element_context_invalid_name__right(self, capsys): - Parser = suds.sax.parser.Parser - e = Parser().parse(string=suds.byte_str("")).root() + Parser = asyncsuds.sax.parser.Parser + e = Parser().parse(string=asyncsuds.byte_str("")).root() e_invalid = object() pytest.raises(AssertionError, CompareSAX.element2element, e, e_invalid) _assert_context_output(capsys, "element2element.") @skip_test_if_CompareSAX_assertions_disabled def test_empty_vs_non_empty_document(self, capsys): - document = suds.sax.document.Document() + document = asyncsuds.sax.document.Document() data = "" pytest.raises(AssertionError, CompareSAX.document2data, document, data) _assert_context_output(capsys, "document2data") diff --git a/tests/test_date_time.py b/tests/test_date_time.py index afcebe03..fd922b67 100644 --- a/tests/test_date_time.py +++ b/tests/test_date_time.py @@ -24,7 +24,7 @@ import testutils testutils.run_using_pytest(globals()) -from suds.sax.date import (FixedOffsetTimezone, Date, DateTime, Time, +from asyncsuds.sax.date import (FixedOffsetTimezone, Date, DateTime, Time, UtcTimezone) import pytest diff --git a/tests/test_dependency_sort.py b/tests/test_dependency_sort.py index b48be3cf..9eff52f4 100644 --- a/tests/test_dependency_sort.py +++ b/tests/test_dependency_sort.py @@ -26,7 +26,7 @@ if __name__ == "__main__": testutils.run_using_pytest(globals()) -from suds.xsd.depsort import dependency_sort +from asyncsuds.xsd.depsort import dependency_sort import pytest from six import iteritems diff --git a/tests/test_document_store.py b/tests/test_document_store.py index 60f2ba9f..c6b49cf2 100644 --- a/tests/test_document_store.py +++ b/tests/test_document_store.py @@ -26,40 +26,40 @@ import testutils testutils.run_using_pytest(globals()) -import suds -import suds.store +import asyncsuds +import asyncsuds.store import pytest def test_accessing_DocumentStore_content(): - content1 = suds.byte_str("one") - content2 = suds.byte_str("two") - content1_1 = suds.byte_str("one one") + content1 = asyncsuds.byte_str("one") + content2 = asyncsuds.byte_str("two") + content1_1 = asyncsuds.byte_str("one one") - store = suds.store.DocumentStore({"1": content1}) + store = asyncsuds.store.DocumentStore({"1": content1}) assert len(store) == 2 _test_default_DocumentStore_content(store) _test_open(store, "1", content1) - store = suds.store.DocumentStore({"1": content1, "2": content2}) + store = asyncsuds.store.DocumentStore({"1": content1, "2": content2}) assert len(store) == 3 _test_default_DocumentStore_content(store) _test_open(store, "1", content1) _test_open(store, "2", content2) - store = suds.store.DocumentStore(uno=content1, due=content2) + store = asyncsuds.store.DocumentStore(uno=content1, due=content2) assert len(store) == 3 _test_default_DocumentStore_content(store) _test_open(store, "uno", content1) _test_open(store, "due", content2) - store = suds.store.DocumentStore({"1 1": content1_1}) + store = asyncsuds.store.DocumentStore({"1 1": content1_1}) assert len(store) == 2 _test_default_DocumentStore_content(store) _test_open(store, "1 1", content1_1) - store = suds.store.DocumentStore({"1": content1, "1 1": content1_1}) + store = asyncsuds.store.DocumentStore({"1": content1, "1 1": content1_1}) assert len(store) == 3 _test_default_DocumentStore_content(store) _test_open(store, "1", content1) @@ -67,7 +67,7 @@ def test_accessing_DocumentStore_content(): def test_accessing_missing_DocumentStore_content(): - store = suds.store.DocumentStore() + store = asyncsuds.store.DocumentStore() assert store.open("missing-content") is None assert store.open("buga-wuga://missing-content") is None assert store.open("ftp://missing-content") is None @@ -77,21 +77,21 @@ def test_accessing_missing_DocumentStore_content(): def test_default_DocumentStore_instance(): - assert len(suds.store.defaultDocumentStore) == 1 - _test_default_DocumentStore_content(suds.store.defaultDocumentStore) + assert len(asyncsuds.store.defaultDocumentStore) == 1 + _test_default_DocumentStore_content(asyncsuds.store.defaultDocumentStore) def test_empty_DocumentStore_instance_is_not_shared(): - assert suds.store.DocumentStore() is not suds.store.defaultDocumentStore - assert suds.store.DocumentStore() is not suds.store.DocumentStore() + assert asyncsuds.store.DocumentStore() is not asyncsuds.store.defaultDocumentStore + assert asyncsuds.store.DocumentStore() is not asyncsuds.store.DocumentStore() def test_updating_DocumentStore_content(): - content1 = suds.byte_str("one") - content2 = suds.byte_str("two") - content1_1 = suds.byte_str("one one") + content1 = asyncsuds.byte_str("one") + content2 = asyncsuds.byte_str("two") + content1_1 = asyncsuds.byte_str("one one") - store = suds.store.DocumentStore() + store = asyncsuds.store.DocumentStore() assert len(store) == 1 _test_default_DocumentStore_content(store) @@ -126,7 +126,7 @@ def test_updating_DocumentStore_content(): def _test_default_DocumentStore_content(store): _test_open(store, "schemas.xmlsoap.org/soap/encoding/", - suds.store.soap5_encoding_schema) + asyncsuds.store.soap5_encoding_schema) def _test_open(store, location, expected_content): diff --git a/tests/test_input_parameters.py b/tests/test_input_parameters.py index f4ab7a75..5765fc1e 100644 --- a/tests/test_input_parameters.py +++ b/tests/test_input_parameters.py @@ -39,7 +39,7 @@ if __name__ == "__main__": testutils.run_using_pytest(globals()) -import suds +import asyncsuds import pytest @@ -345,7 +345,7 @@ def test_builtin_typed_element_parameter(part_name): a built-in typed element. """ - wsdl = suds.byte_str("""\ + wsdl = asyncsuds.byte_str("""\ """) - wsdl = suds.byte_str("".join(wsdl)) + wsdl = asyncsuds.byte_str("".join(wsdl)) client = testutils.client_from_wsdl(wsdl, nosend=True) # Collect references to required WSDL model content. method = client.wsdl.services[0].ports[0].methods["f"] assert not method.soap.input.body.wrapped binding = method.binding.input - assert binding.__class__ is suds.bindings.document.Document + assert binding.__class__ is asyncsuds.bindings.document.Document my_type = client.wsdl.schema.types["MyType", "my-namespace"] # Construct expected parameter definitions. expected_param_defs = [ - (param_name, [suds.bindings.binding.PartElement, param_name, my_type]) + (param_name, [asyncsuds.bindings.binding.PartElement, param_name, my_type]) for param_name in param_names] param_defs = binding.param_defs(method) @@ -509,7 +509,7 @@ def test_unwrapped_parameter(xsd_type): method = client.wsdl.services[0].ports[0].methods["f"] assert method.soap.input.body.wrapped binding = method.binding.input - assert binding.__class__ is suds.bindings.document.Document + assert binding.__class__ is asyncsuds.bindings.document.Document wrapper = client.wsdl.schema.elements["Wrapper", "my-namespace"] # Construct expected parameter definitions. @@ -534,7 +534,7 @@ def test_unwrapped_parameter_part_name(part_name): method = client.wsdl.services[0].ports[0].methods["f"] assert method.soap.input.body.wrapped binding = method.binding.input - assert binding.__class__ is suds.bindings.document.Document + assert binding.__class__ is asyncsuds.bindings.document.Document wrapper = client.wsdl.schema.elements["Wrapper", "my-namespace"] # Construct expected parameter definitions. @@ -636,7 +636,7 @@ def _unwrappable_wsdl(part_name, param_schema): 'param_schema' argument. """ - return suds.byte_str("""\ + return asyncsuds.byte_str("""\ """, output="Elemento")) for client in (client_unnamed, client_named, client_twice_restricted): - response = client.service.f(__inject=dict(reply=suds.byte_str("""\ + response = client.service.f(__inject=dict(reply=asyncsuds.byte_str("""\ @@ -136,7 +136,7 @@ def test_disabling_automated_simple_interface_unwrapping(): """, output="Wrapper"), unwrap=False) assert not _isOutputWrapped(client, "f") - response = client.service.f(__inject=dict(reply=suds.byte_str("""\ + response = client.service.f(__inject=dict(reply=asyncsuds.byte_str("""\ @@ -148,15 +148,15 @@ def test_disabling_automated_simple_interface_unwrapping(): assert response.__class__.__name__ == "Wrapper" assert len(response.__class__.__bases__) == 1 - assert response.__class__.__bases__[0] is suds.sudsobject.Object - assert response.Elemento.__class__ is suds.sax.text.Text + assert response.__class__.__bases__[0] is asyncsuds.sudsobject.Object + assert response.Elemento.__class__ is asyncsuds.sax.text.Text assert response.Elemento == "La-di-da-da-da" def test_empty_reply(): client = testutils.client_from_wsdl(_wsdl__simple_f, faults=False) def f(status=None, description=None): - inject = dict(reply=suds.byte_str(), status=status, + inject = dict(reply=asyncsuds.byte_str(), status=status, description=description) return client.service.f(__inject=inject) status, reason = f() @@ -182,7 +182,7 @@ def test_fault_reply_with_unicode_faultstring(monkeypatch): unicode_string = u("\u20AC Jurko Gospodneti\u0107 " "\u010C\u0106\u017D\u0160\u0110" "\u010D\u0107\u017E\u0161\u0111") - fault_xml = suds.byte_str(u("""\ + fault_xml = asyncsuds.byte_str(u("""\ @@ -196,10 +196,10 @@ def test_fault_reply_with_unicode_faultstring(monkeypatch): client = testutils.client_from_wsdl(_wsdl__simple_f, faults=True) inject = dict(reply=fault_xml, status=http_client.INTERNAL_SERVER_ERROR) - e = pytest.raises(suds.WebFault, client.service.f, __inject=inject).value + e = pytest.raises(asyncsuds.WebFault, client.service.f, __inject=inject).value try: assert e.fault.faultstring == unicode_string - assert e.document.__class__ is suds.sax.document.Document + assert e.document.__class__ is asyncsuds.sax.document.Document finally: del e # explicitly break circular reference chain in Python 3 @@ -213,7 +213,7 @@ def test_fault_reply_with_unicode_faultstring(monkeypatch): def test_invalid_fault_namespace(monkeypatch): monkeypatch.delitem(locals(), "e", False) - fault_xml = suds.byte_str("""\ + fault_xml = asyncsuds.byte_str("""\ @@ -261,7 +261,7 @@ def test_missing_wrapper_response(): assert _isOutputWrapped(client, "f") response_with_missing_wrapper = client.service.f(__inject=dict( - reply=suds.byte_str(""" + reply=asyncsuds.byte_str(""" Anything @@ -277,11 +277,11 @@ def test_reply_error_with_detail_with_fault(monkeypatch): for http_status in (http_client.OK, http_client.INTERNAL_SERVER_ERROR): inject = dict(reply=_fault_reply__with_detail, status=http_status) - e = pytest.raises(suds.WebFault, client.service.f, __inject=inject) + e = pytest.raises(asyncsuds.WebFault, client.service.f, __inject=inject) try: e = e.value _test_fault(e.fault, True) - assert e.document.__class__ is suds.sax.document.Document + assert e.document.__class__ is asyncsuds.sax.document.Document assert str(e) == "Server raised fault: 'Dummy error.'" finally: del e # explicitly break circular reference chain in Python 3 @@ -325,11 +325,11 @@ def test_reply_error_without_detail_with_fault(monkeypatch): for http_status in (http_client.OK, http_client.INTERNAL_SERVER_ERROR): inject = dict(reply=_fault_reply__without_detail, status=http_status) - e = pytest.raises(suds.WebFault, client.service.f, __inject=inject) + e = pytest.raises(asyncsuds.WebFault, client.service.f, __inject=inject) try: e = e.value _test_fault(e.fault, False) - assert e.document.__class__ is suds.sax.document.Document + assert e.document.__class__ is asyncsuds.sax.document.Document assert str(e) == "Server raised fault: 'Dummy error.'" finally: del e # explicitly break circular reference chain in Python 3 @@ -385,7 +385,7 @@ def test_simple_bare_and_wrapped_output(): # extra wrapper element around its received output data. data = "The meaning of life." def get_response(client, x): - return client.service.f(__inject=dict(reply=suds.byte_str(x))) + return client.service.f(__inject=dict(reply=asyncsuds.byte_str(x))) response_bare = get_response(client_bare, """ @@ -393,7 +393,7 @@ def get_response(client, x): %s """ % (data,)) - assert response_bare.__class__ is suds.sax.text.Text + assert response_bare.__class__ is asyncsuds.sax.text.Text assert response_bare == data response_wrapped = get_response(client_wrapped, """ @@ -404,7 +404,7 @@ def get_response(client, x): """ % (data,)) - assert response_wrapped.__class__ is suds.sax.text.Text + assert response_wrapped.__class__ is asyncsuds.sax.text.Text assert response_wrapped == data @@ -421,7 +421,7 @@ def test_wrapped_sequence_output(): """, output="Wrapper")) assert _isOutputWrapped(client, "f") - response = client.service.f(__inject=dict(reply=suds.byte_str("""\ + response = client.service.f(__inject=dict(reply=asyncsuds.byte_str("""\ @@ -437,16 +437,16 @@ def test_wrapped_sequence_output(): # class named 'reply'. assert len(response.__class__.__bases__) == 1 assert response.__class__.__name__ == "reply" - assert response.__class__.__bases__[0] is suds.sudsobject.Object + assert response.__class__.__bases__[0] is asyncsuds.sudsobject.Object # Check response content. assert len(response) == 3 assert response.result1 == "Uno" assert response.result2 == "Due" assert response.result3 == "Tre" - assert response.result1.__class__ is suds.sax.text.Text - assert response.result2.__class__ is suds.sax.text.Text - assert response.result3.__class__ is suds.sax.text.Text + assert response.result1.__class__ is asyncsuds.sax.text.Text + assert response.result2.__class__ is asyncsuds.sax.text.Text + assert response.result3.__class__ is asyncsuds.sax.text.Text def _attributes(object): @@ -476,7 +476,7 @@ def _test_fault(fault, has_detail): assert not has_detail or _attributes(fault.detail) == set(("errorcode",)) -_fault_reply__with_detail = suds.byte_str("""\ +_fault_reply__with_detail = asyncsuds.byte_str("""\ @@ -491,7 +491,7 @@ def _test_fault(fault, has_detail): """) -_fault_reply__without_detail = suds.byte_str("""\ +_fault_reply__without_detail = asyncsuds.byte_str("""\ diff --git a/tests/test_request_construction.py b/tests/test_request_construction.py index 4ce9e8a5..51aabaee 100644 --- a/tests/test_request_construction.py +++ b/tests/test_request_construction.py @@ -32,8 +32,8 @@ if __name__ == "__main__": testutils.run_using_pytest(globals()) -import suds -import suds.store +import asyncsuds +import asyncsuds.store from testutils.compare_sax import CompareSAX import pytest @@ -420,7 +420,7 @@ def test_disabling_automated_simple_interface_unwrapping(): def test_element_references_to_different_namespaces(): - wsdl = suds.byte_str("""\ + wsdl = asyncsuds.byte_str("""\ """) - external_schema = suds.byte_str("""\ + external_schema = asyncsuds.byte_str("""\ """) - store = suds.store.DocumentStore(external_schema=external_schema, + store = asyncsuds.store.DocumentStore(external_schema=external_schema, wsdl=wsdl) - client = suds.client.Client("suds://wsdl", cache=None, documentStore=store, + client = asyncsuds.client.Client("suds://wsdl", cache=None, documentStore=store, nosend=True, prettyxml=True) _assert_request_content(client.service.f(local="--L--", local_referenced="--LR--", external="--E--"), """\ @@ -796,7 +796,7 @@ def test_optional_parameter_handling(): def test_SOAP_headers(): """Rudimentary 'soapheaders' option usage test.""" - wsdl = suds.byte_str("""\ + wsdl = asyncsuds.byte_str("""\ @@ -51,14 +51,14 @@ def create_test_document(): """) - document = suds.sax.parser.Parser().parse(suds.BytesIO(input_data)) + document = asyncsuds.sax.parser.Parser().parse(asyncsuds.BytesIO(input_data)) assert document.__class__ is Document return document @pytest.mark.skipif(sys.version_info >= (3,), reason="Python 2 specific") def test_convert_to_byte_str(self): document = self.create_test_document() - expected = suds.byte_str(document.str()) + expected = asyncsuds.byte_str(document.str()) assert str(document) == expected def test_convert_to_unicode(self): diff --git a/tests/test_sax_element.py b/tests/test_sax_element.py index 1bacce8f..e3d372cf 100644 --- a/tests/test_sax_element.py +++ b/tests/test_sax_element.py @@ -26,9 +26,9 @@ import testutils testutils.run_using_pytest(globals()) -import suds -from suds.sax.element import Element -import suds.sax.parser +import asyncsuds +from asyncsuds.sax.element import Element +import asyncsuds.sax.parser import pytest import six @@ -141,8 +141,8 @@ class TestStringRepresentation: @staticmethod def create_test_element(content=str_formatted_xml): - input_data = suds.byte_str(content) - xml = suds.sax.parser.Parser().parse(suds.BytesIO(input_data)) + input_data = asyncsuds.byte_str(content) + xml = asyncsuds.sax.parser.Parser().parse(asyncsuds.BytesIO(input_data)) element = xml.root() assert element.__class__ is Element return element @@ -150,7 +150,7 @@ def create_test_element(content=str_formatted_xml): @pytest.mark.skipif(sys.version_info >= (3,), reason="Python 2 specific") def test_convert_to_byte_str(self): element = self.create_test_element() - expected = suds.byte_str(element.str()) + expected = asyncsuds.byte_str(element.str()) assert str(element) == expected def test_convert_to_unicode(self): diff --git a/tests/test_sax_encoder.py b/tests/test_sax_encoder.py index f7d1f37c..eba2290a 100644 --- a/tests/test_sax_encoder.py +++ b/tests/test_sax_encoder.py @@ -26,7 +26,7 @@ import testutils testutils.run_using_pytest(globals()) -import suds.sax.enc +import asyncsuds.sax.enc import pytest @@ -159,7 +159,7 @@ ("&apos;", "'"), ("&quot;", """)]) def test_decode(input, expected): - assert suds.sax.enc.Encoder().decode(input) == expected + assert asyncsuds.sax.enc.Encoder().decode(input) == expected @pytest.mark.parametrize(("input", "expected"), @@ -179,4 +179,4 @@ def test_decode(input, expected): ("'", "'"), (""", """)]) def test_encode(input, expected): - assert suds.sax.enc.Encoder().encode(input) == expected + assert asyncsuds.sax.enc.Encoder().encode(input) == expected diff --git a/tests/test_suds.py b/tests/test_suds.py index 3c6785e4..8ea7e2cd 100644 --- a/tests/test_suds.py +++ b/tests/test_suds.py @@ -29,7 +29,7 @@ if __name__ == "__main__": testutils.run_using_pytest(globals()) -import suds +import asyncsuds from testutils.compare_sax import CompareSAX import pytest @@ -89,13 +89,13 @@ def client(x, y): def test_converting_client_to_string_must_not_raise_an_exception(): - client = testutils.client_from_wsdl(suds.byte_str( + client = testutils.client_from_wsdl(asyncsuds.byte_str( "")) str(client) def test_converting_metadata_to_string(): - client = testutils.client_from_wsdl(suds.byte_str("""\ + client = testutils.client_from_wsdl(asyncsuds.byte_str("""\ ")) assert not client.wsdl.services, "No service definitions must be read " \ "from an empty WSDL." def test_enumeration_type_string_should_contain_its_value(): - client = testutils.client_from_wsdl(suds.byte_str("""\ + client = testutils.client_from_wsdl(asyncsuds.byte_str("""\ for # old-style class instances while the __class__ member returns the correct # class information for both old and new-style classes. - assert anObject.__class__.__module__ == suds.sudsobject.__name__ + assert anObject.__class__.__module__ == asyncsuds.sudsobject.__name__ assert anObject.__class__.__name__ == typename diff --git a/tests/test_timezone.py b/tests/test_timezone.py index 81c0df8e..c2f2a0fd 100644 --- a/tests/test_timezone.py +++ b/tests/test_timezone.py @@ -26,7 +26,7 @@ import testutils testutils.run_using_pytest(globals()) -from suds.sax.date import FixedOffsetTimezone, UtcTimezone +from asyncsuds.sax.date import FixedOffsetTimezone, UtcTimezone import pytest diff --git a/tests/test_transport.py b/tests/test_transport.py index d045aafd..22360a54 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -26,9 +26,9 @@ import testutils testutils.run_using_pytest(globals()) -import suds -from suds.transport import Reply, Request, Transport -import suds.transport.options +import asyncsuds +from asyncsuds.transport import Reply, Request, Transport +import asyncsuds.transport.options import pytest from six import b, text_type, u, unichr @@ -40,7 +40,7 @@ class TestBaseTransportClass: def test_members(self): t = Transport() - assert t.options.__class__ is suds.transport.options.Options + assert t.options.__class__ is asyncsuds.transport.options.Options @pytest.mark.parametrize("method_name", ("open", "send")) def test_methods_should_be_abstract(self, monkeypatch, method_name): @@ -163,7 +163,7 @@ def test_string_representation_with_message(self, url, headers, message): def test_string_representation_with_no_message(self): url = "look at my silly little URL" - headers = {suds.byte_str("yuck"): suds.byte_str("ptooiii...")} + headers = {asyncsuds.byte_str("yuck"): asyncsuds.byte_str("ptooiii...")} request = Request(url) request.headers = headers expected = u("""\ diff --git a/tests/test_transport_http.py b/tests/test_transport_http.py index 9b25983e..e9f343f8 100644 --- a/tests/test_transport_http.py +++ b/tests/test_transport_http.py @@ -26,9 +26,9 @@ if __name__ == "__main__": testutils.run_using_pytest(globals()) -import suds -import suds.transport -import suds.transport.http +import asyncsuds +import asyncsuds.transport +import asyncsuds.transport.http import pytest from six import u @@ -154,7 +154,7 @@ def __init__(self, name): self.name = name def __call__(self, transport, *args, **kwargs): - assert isinstance(transport, suds.transport.http.HttpTransport) + assert isinstance(transport, asyncsuds.transport.http.HttpTransport) return getattr(transport, self.name)(*args, **kwargs) @@ -170,13 +170,13 @@ def __call__(self, transport, *args, **kwargs): def assert_default_transport(transport): """Test utility verifying default constructed transport content.""" - assert isinstance(transport, suds.transport.http.HttpTransport) + assert isinstance(transport, asyncsuds.transport.http.HttpTransport) assert transport.urlopener is None def create_request(url="protocol://default-url", data=u("Rumpelstiltskin")): """Test utility constructing a suds.transport.Request instance.""" - return suds.transport.Request(url, data) + return asyncsuds.transport.Request(url, data) @pytest.fixture(params=["open", "send"]) @@ -220,7 +220,7 @@ def assert_Authorization_header(request, username, password): username = input.get("username", None) password = input.get("password", None) - t = suds.transport.http.HttpAuthenticated(**input) + t = asyncsuds.transport.http.HttpAuthenticated(**input) r = MockRequest() t.addcredentials(r) assert_Authorization_header(r, username, password) @@ -233,13 +233,13 @@ def assert_Authorization_header(request, username, password): def test_construct_authenticated_http(input): expected_username = input.get("username", None) expected_password = input.get("password", None) - transport = suds.transport.http.HttpAuthenticated(**input) + transport = asyncsuds.transport.http.HttpAuthenticated(**input) assert transport.credentials() == (expected_username, expected_password) assert_default_transport(transport) def test_construct_http(): - transport = suds.transport.http.HttpTransport() + transport = asyncsuds.transport.http.HttpTransport() assert_default_transport(transport) @@ -269,7 +269,7 @@ def getaddrinfo(self, host, port, *args, **kwargs): return [(None, None, None, None, self.host_address)] def mock_reset(self): super(Mocker, self).mock_reset() - self.mock_sent_data = suds.byte_str() + self.mock_sent_data = asyncsuds.byte_str() self.mock_socket = None def socket(self, *args, **kwargs): assert self.mock_socket is None @@ -308,14 +308,14 @@ def readline(self, *args, **kwargs): host_port = "%s:%s" % (host, port) url_relative = "svc" url = "http://%s/%s" % (host_port, url_relative) - partial_ascii_byte_data = suds.byte_str("Muka-laka-hiki") + partial_ascii_byte_data = asyncsuds.byte_str("Muka-laka-hiki") non_ascii_byte_data = u("\u0414\u043C\u0438 \u0442\u0440").encode("utf-8") non_ascii_byte_data += partial_ascii_byte_data mocker = Mocker(host, port) monkeypatch.setattr("socket.getaddrinfo", mocker.getaddrinfo) monkeypatch.setattr("socket.socket", mocker.socket) - request = suds.transport.Request(url, non_ascii_byte_data) - transport = suds.transport.http.HttpTransport() + request = asyncsuds.transport.Request(url, non_ascii_byte_data) + transport = asyncsuds.transport.http.HttpTransport() expected_sent_data_start, expected_request_data_send = { "open": ("GET", False), "send": ("POST", True)}[send_method.name] @@ -340,10 +340,10 @@ def readline(self, *args, **kwargs): # implement the settimeout() method. assert mocker.mock_socket.mock_call_count("settimeout") in (0, 1) assert mocker.mock_socket.mock_reader.mock_call_count("readline") == 1 - assert mocker.mock_sent_data.__class__ is suds.byte_str_class + assert mocker.mock_sent_data.__class__ is asyncsuds.byte_str_class expected_sent_data_start = "%s /%s HTTP/1.1\r\n" % ( expected_sent_data_start, url_relative) - expected_sent_data_start = suds.byte_str(expected_sent_data_start) + expected_sent_data_start = asyncsuds.byte_str(expected_sent_data_start) assert mocker.mock_sent_data.startswith(expected_sent_data_start) assert host_port.encode("utf-8") in mocker.mock_sent_data if expected_request_data_send: @@ -371,7 +371,7 @@ class TestSendingToURLWithAMissingProtocolIdentifier: @pytest.mark.skipif(sys.version_info >= (3,), reason="Python 2 specific") @invalid_URL_parametrization def test_python2(self, url, send_method): - transport = suds.transport.http.HttpTransport() + transport = asyncsuds.transport.http.HttpTransport() transport.urlopener = MockURLOpenerSaboteur(MyException) request = create_request(url) pytest.raises(MyException, send_method, transport, request) @@ -380,7 +380,7 @@ def test_python2(self, url, send_method): @invalid_URL_parametrization def test_python3(self, url, send_method, monkeypatch): monkeypatch.delitem(locals(), "e", False) - transport = suds.transport.http.HttpTransport() + transport = asyncsuds.transport.http.HttpTransport() transport.urlopener = MockURLOpenerSaboteur() request = create_request(url) e = pytest.raises(ValueError, send_method, transport, request) @@ -443,12 +443,12 @@ def test_open_propagating_HTTPError_exceptions(self, status_code, monkeypatch.delattr(locals(), "e", False) fp = MockFP() e_original = self.create_HTTPError(code=status_code, fp=fp) - t = suds.transport.http.HttpTransport() + t = asyncsuds.transport.http.HttpTransport() t.urlopener = MockURLOpenerSaboteur(open_exception=e_original) request = create_request() # Execute. - e = pytest.raises(suds.transport.TransportError, t.open, request).value + e = pytest.raises(asyncsuds.transport.TransportError, t.open, request).value try: # Verify. assert e.args == (str(e_original),) @@ -471,12 +471,12 @@ def test_operation_invoke_with_urlopen_accept_no_content__data(self, """ e = self.create_HTTPError(code=status_code) - transport = suds.transport.http.HttpTransport() + transport = asyncsuds.transport.http.HttpTransport() transport.urlopener = MockURLOpenerSaboteur(open_exception=e) wsdl = testutils.wsdl('', output="o", operation_name="f") client = testutils.client_from_wsdl(wsdl, transport=transport) - pytest.raises(suds.transport.TransportError, client.service.f) + pytest.raises(asyncsuds.transport.TransportError, client.service.f) @pytest.mark.xfail(reason="original suds library bug") @pytest.mark.parametrize("status_code", ( @@ -499,7 +499,7 @@ def test_operation_invoke_with_urlopen_accept_no_content__no_data(self, # exception by attempting to access a non-existing 'None.message' # attribute internally. e = self.create_HTTPError(code=status_code) - transport = suds.transport.http.HttpTransport() + transport = asyncsuds.transport.http.HttpTransport() transport.urlopener = MockURLOpenerSaboteur(open_exception=e) wsdl = testutils.wsdl('', output="o", operation_name="f") @@ -513,7 +513,7 @@ def test_propagating_non_HTTPError_exceptions(self, send_method): """ e = MyException() - t = suds.transport.http.HttpTransport() + t = asyncsuds.transport.http.HttpTransport() t.urlopener = MockURLOpenerSaboteur(open_exception=e) assert pytest.raises(e.__class__, t.open, create_request()).value is e @@ -540,12 +540,12 @@ def test_send_transforming_HTTPError_exceptions(self, status_code, msg = object() fp = MockFP() e_original = self.create_HTTPError(msg=msg, code=status_code, fp=fp) - t = suds.transport.http.HttpTransport() + t = asyncsuds.transport.http.HttpTransport() t.urlopener = MockURLOpenerSaboteur(open_exception=e_original) request = create_request() # Execute. - e = pytest.raises(suds.transport.TransportError, t.send, request).value + e = pytest.raises(asyncsuds.transport.TransportError, t.send, request).value try: # Verify. assert len(e.args) == 1 @@ -567,7 +567,7 @@ def test_send_transforming_HTTPError_exceptions__accepted_no_content(self, """ e_original = self.create_HTTPError(code=status_code) - t = suds.transport.http.HttpTransport() + t = asyncsuds.transport.http.HttpTransport() t.urlopener = MockURLOpenerSaboteur(open_exception=e_original) assert t.send(create_request()) is None @@ -582,7 +582,7 @@ def my_build_urlopener(*handlers): assert handlers[0].__class__ is ProxyHandler raise MyException monkeypatch.setattr(urllib_request, "build_opener", my_build_urlopener) - transport = suds.transport.http.HttpTransport() + transport = asyncsuds.transport.http.HttpTransport() request = create_request(url=url) pytest.raises(MyException, send_method, transport, request) @@ -601,7 +601,7 @@ def open(self, request, timeout=None): assert request.__class__ is urllib_request.Request assert request.get_full_url() == url raise MyException - transport = suds.transport.http.HttpTransport() + transport = asyncsuds.transport.http.HttpTransport() transport.urlopener = MockURLOpener() def my_build_urlopener(*args, **kwargs): pytest.fail("urllib build_opener() called when not expected.") @@ -617,5 +617,5 @@ def _encode_basic_credentials(username, password): This is the value expected to be added to the 'Authorization' HTTP header. """ - data = suds.byte_str("%s:%s" % (username, password)) + data = asyncsuds.byte_str("%s:%s" % (username, password)) return "Basic %s" % base64.b64encode(data).decode("utf-8") diff --git a/tests/test_xsd_builtins.py b/tests/test_xsd_builtins.py index c9a6b1f5..b665ac00 100644 --- a/tests/test_xsd_builtins.py +++ b/tests/test_xsd_builtins.py @@ -26,9 +26,9 @@ if __name__ == "__main__": testutils.run_using_pytest(globals()) -import suds.client -import suds.sax.date -from suds.xsd.sxbuiltin import (Factory, XAny, XBoolean, XBuiltin, XDate, +import asyncsuds.client +import asyncsuds.sax.date +from asyncsuds.xsd.sxbuiltin import (Factory, XAny, XBoolean, XBuiltin, XDate, XDateTime, XDecimal, XFloat, XInteger, XLong, XString, XTime) from testutils.compare_sax import CompareSAX @@ -77,7 +77,7 @@ def _def_mock_xsd_class(x_class_name): of its parent classes. """ - x_class = getattr(suds.xsd.sxbuiltin, x_class_name) + x_class = getattr(asyncsuds.xsd.sxbuiltin, x_class_name) assert issubclass(x_class, XBuiltin) mock_class_name = "Mock" + x_class_name mock_class = type(mock_class_name, (x_class,), { @@ -209,13 +209,13 @@ class TestXDate: def test_from_python_object__date(self): date = datetime.date(2013, 7, 24) translated = MockXDate().translate(date, topython=False) - assert translated.__class__ is suds.sax.date.Date + assert translated.__class__ is asyncsuds.sax.date.Date assert str(translated) == "2013-07-24" def test_from_python_object__datetime(self): dt = datetime.datetime(2013, 7, 24, 11, 59, 4) translated = MockXDate().translate(dt, topython=False) - assert translated.__class__ is suds.sax.date.Date + assert translated.__class__ is asyncsuds.sax.date.Date assert str(translated) == "2013-07-24" @pytest.mark.parametrize("source", ( @@ -246,7 +246,7 @@ class TestXDateTime: def test_from_python_object(self): dt = datetime.datetime(2021, 12, 31, 11, 25) translated = MockXDateTime().translate(dt, topython=False) - assert translated.__class__ is suds.sax.date.DateTime + assert translated.__class__ is asyncsuds.sax.date.DateTime assert str(translated) == "2021-12-31T11:25:00" @pytest.mark.parametrize("source", ( @@ -601,7 +601,7 @@ class TestXTime: def test_from_python_object(self): time = datetime.time(16, 53, 12) translated = MockXTime().translate(time, topython=False) - assert translated.__class__ is suds.sax.date.Time + assert translated.__class__ is asyncsuds.sax.date.Time assert str(translated) == "16:53:12" @pytest.mark.parametrize("source", ( @@ -753,7 +753,7 @@ def translate(self, value, topython=True): """ % (namespace,)) # Process operation response - test unmarshalling. - response = client.service.f(__inject=dict(reply=suds.byte_str("""\ + response = client.service.f(__inject=dict(reply=asyncsuds.byte_str("""\ diff --git a/tests/test_xsd_element.py b/tests/test_xsd_element.py index 58d32f37..8e11f7d7 100644 --- a/tests/test_xsd_element.py +++ b/tests/test_xsd_element.py @@ -27,11 +27,11 @@ testutils.run_using_pytest(globals()) -import suds -import suds.options -import suds.sax.parser -import suds.store -import suds.xsd.schema +import asyncsuds +import asyncsuds.options +import asyncsuds.sax.parser +import asyncsuds.store +import asyncsuds.xsd.schema import pytest from six import b @@ -128,7 +128,7 @@ def test_reference_to_external(self): """ - store = suds.store.DocumentStore({"there.xsd": b(schema_xml_there)}) + store = asyncsuds.store.DocumentStore({"there.xsd": b(schema_xml_there)}) schema = _parse_schema_xml(b(schema_xml_here), store) referenced_element = schema.elements["Referenced", "ns-there"] referencing_parent = schema.elements["Referencing", None] @@ -175,7 +175,7 @@ def test_reference(): """ - store = suds.store.DocumentStore({"there.xsd": b(schema_xml_there)}) + store = asyncsuds.store.DocumentStore({"there.xsd": b(schema_xml_there)}) schema = _parse_schema_xml(b(schema_xml_here), store) referenced_element = schema.elements["Referenced", "ns-there"] referencing_parent = schema.elements["Referencing", None] @@ -198,12 +198,12 @@ def _attribute_xml(name, value): def _parse_schema_xml(xml, documentStore=None): """Test utility constructing an XSD schema model from the given XML.""" - parser = suds.sax.parser.Parser() + parser = asyncsuds.sax.parser.Parser() document = parser.parse(string=xml) root = document.root() url = "somewhere://over.the/rainbow" options_kwargs = {} if documentStore: options_kwargs.update(documentStore=documentStore) - options = suds.options.Options(**options_kwargs) - return suds.xsd.schema.Schema(root, url, options) + options = asyncsuds.options.Options(**options_kwargs) + return asyncsuds.xsd.schema.Schema(root, url, options) diff --git a/tests/testutils/__init__.py b/tests/testutils/__init__.py index c716ab15..7fb810f8 100644 --- a/tests/testutils/__init__.py +++ b/tests/testutils/__init__.py @@ -20,8 +20,8 @@ """ -import suds.client -import suds.store +import asyncsuds.client +import asyncsuds.store import os import subprocess @@ -50,15 +50,15 @@ def client_from_wsdl(wsdl_content, *args, **kwargs): store. """ - assert wsdl_content.__class__ is suds.byte_str_class, "bad test data" + assert wsdl_content.__class__ is asyncsuds.byte_str_class, "bad test data" store = kwargs.get("documentStore") if store is None: - store = suds.store.DocumentStore() + store = asyncsuds.store.DocumentStore() kwargs.update(documentStore=store) test_file_id = "whatchamacallit" store.update({test_file_id: wsdl_content}) kwargs.update(cache=None) - return suds.client.Client("suds://" + test_file_id, *args, **kwargs) + return asyncsuds.client.Client("suds://" + test_file_id, *args, **kwargs) def run_test_process(script): @@ -91,7 +91,7 @@ def exec_file(x): else: exec_file = execfile exec_file(%(script)r) -""" % {"suds.__version__": suds.__version__, +""" % {"suds.__version__": asyncsuds.__version__, "script": script.basename, "sys.path": sys_path}) if popen.returncode != 0 or err or out: @@ -235,4 +235,4 @@ def wsdl(schema_content, input=None, output=None, operation_name="f", """ % (web_service_URL,)) - return suds.byte_str("\n".join(wsdl)) + return asyncsuds.byte_str("\n".join(wsdl)) diff --git a/tests/testutils/compare_sax__pytest_assert_rewrite_needed.py b/tests/testutils/compare_sax__pytest_assert_rewrite_needed.py index 0aa133c9..0a907678 100644 --- a/tests/testutils/compare_sax__pytest_assert_rewrite_needed.py +++ b/tests/testutils/compare_sax__pytest_assert_rewrite_needed.py @@ -27,9 +27,9 @@ """ -import suds.sax.document -import suds.sax.element -import suds.sax.parser +import asyncsuds.sax.document +import asyncsuds.sax.element +import asyncsuds.sax.parser from six import text_type, u @@ -109,8 +109,8 @@ def document2element(cls, document, element): self = cls() self.__push_context("document2element") try: - assert document.__class__ is suds.sax.document.Document - assert element.__class__ is suds.sax.element.Element + assert document.__class__ is asyncsuds.sax.document.Document + assert element.__class__ is asyncsuds.sax.element.Element assert len(document.getChildren()) == 1 self.__element2element(document.getChildren()[0], element) except Exception: @@ -218,8 +218,8 @@ def __document2document(self, lhs, rhs, context): """ self.__push_context(context) - assert lhs.__class__ is suds.sax.document.Document - assert rhs.__class__ is suds.sax.document.Document + assert lhs.__class__ is asyncsuds.sax.document.Document + assert rhs.__class__ is asyncsuds.sax.document.Document self.__compare_child_elements(lhs, rhs) self.__pop_context() @@ -247,8 +247,8 @@ def __element2element(self, lhs, rhs, context_info=(0, 1)): """ context = self.__element2element_context(lhs, rhs, context_info) self.__push_context(context) - assert lhs.__class__ is suds.sax.element.Element - assert rhs.__class__ is suds.sax.element.Element + assert lhs.__class__ is asyncsuds.sax.element.Element + assert rhs.__class__ is asyncsuds.sax.element.Element assert lhs.name == rhs.name self.__compare_element_namespace(lhs, rhs) self.__compare_element_text(lhs, rhs) @@ -284,7 +284,7 @@ def __parse_data(data): """ if isinstance(data, text_type): data = data.encode("utf-8") - return suds.sax.parser.Parser().parse(string=data) + return asyncsuds.sax.parser.Parser().parse(string=data) def __pop_context(self): self.__context.pop() diff --git a/tools/run_all_tests.py b/tools/run_all_tests.py index d77e5cab..1058121e 100644 --- a/tools/run_all_tests.py +++ b/tools/run_all_tests.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# written by: Jurko Gospodnetiæ ( jurko.gospodnetic@pke.hr ) +# written by: Jurko Gospodneti� ( jurko.gospodnetic@pke.hr ) """ "poor man's tox" development script used on Windows to run the full suds-jurko