Permalink
Browse files

tree-wide: drop support for python 2.7

This reverts the following commits:

- 641d7e7.
- 895cb54.
- 6c4abd3.
- f7c2dd9.
- 364af26.

And also adds some additional changes.
  • Loading branch information...
pope1ni committed May 8, 2017
1 parent 2cc6d09 commit 7e41de1bdc8850f9088ac7b483cf72d5481199f2
View
@@ -1,7 +1,6 @@
sudo: false
language: python
python:
- 2.6
- 2.7
- 3.3
- 3.4
@@ -22,15 +21,6 @@ matrix:
allow_failures:
- python: nightly
exclude:
- python: 2.6
env: FRAMEWORK=django~=1.7.0
- python: 2.6
env: FRAMEWORK=django~=1.8.0
- python: 2.6
env: FRAMEWORK=django~=1.9.0
- python: 2.6
env: FRAMEWORK=django~=1.10.0
- python: 2.6
env: FRAMEWORK=django~=1.11.0
- python: 3.3
env: FRAMEWORK=django~=1.9.0
View
@@ -49,7 +49,7 @@ the `soapfish` fork.
- Attempts to fix handling of remote vs local imports.
- **Miscellaneous:**
- Renamed `SoapboxRequest` and `SoapboxResponse` to `SOAPRequest` and `SOAPResponse` respectively.
- Support Python 2.6, 2.7 and 3.3 - 3.6, and Django 1.6 - 1.11.
- Support Python 2.7 and 3.3 - 3.6, and Django 1.6 - 1.11.
- Improved testing against different versions of Python, Django & Flask.
- Improved entry points for generation scripts - additional flags, etc.
- Moved to using an external dependency for `iso8601`
View
@@ -27,7 +27,7 @@ Currently the project supports the following:
Other notable features include:
- Support for Python 2.6, 2.7 and 3.3+
- Support for Python 2.7 and 3.3+
- Licensed under the 3-clause BSD license
- Code generation utilities to get started quickly
- Parsing/serializing a Python class model from/to XML so you can easily work
View
@@ -4,4 +4,3 @@ coverage
isort
mock
nose>=1.0
unittest2
View
@@ -1,4 +1,3 @@
argparse
iso8601
jinja2
lxml
View
@@ -9,8 +9,8 @@
import soapfish
if sys.version_info < (2, 6) or (3, 0) <= sys.version_info < (3, 3):
sys.stderr.write('Soapfish requires Python 2.6, 2.7 or 3.3+')
if sys.version_info < (2, 7) or (3, 0) <= sys.version_info < (3, 3):
sys.stderr.write('soapfish requires Python 2.7 or 3.3+')
sys.exit(1)
@@ -74,7 +74,6 @@ def requirements(*filenames):
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
@@ -3,6 +3,7 @@
from __future__ import absolute_import, unicode_literals
import contextlib
import importlib
import logging
import os
import random
@@ -14,11 +15,6 @@
from six.moves import range
try:
import importlib
except ImportError:
importlib = None
__all__ = ['generated_symbols', 'import_code']
@@ -57,10 +53,7 @@ def import_code(code):
with open(os.path.join(tmp_dir, module_name) + ".py", 'w+b') as f:
f.write(code)
sys.path.append(tmp_dir)
if importlib:
code_module = importlib.import_module(module_name)
else:
code_module = __import__(module_name, globals(), {}) # XXX: Python 2.6
code_module = importlib.import_module(module_name)
yield code_module
finally:
if code_module is not None:
View
@@ -190,7 +190,7 @@ def find_xsd_namespaces(xml):
nsmap = xml.nsmap.copy()
for x in xml.xpath('//*[local-name()="schema"]'):
nsmap.update(x.nsmap)
return set(k for k, v in six.iteritems(nsmap) if v in (ns.xsd, ns.xsd2000))
return {k for k, v in six.iteritems(nsmap) if v in (ns.xsd, ns.xsd2000)}
def walk_schema_tree(schemas, callback, seen=None):
View
@@ -31,7 +31,7 @@ def reorder_schemas(schemas):
while x and counter > 0:
counter -= 1
schema = x.popleft()
ns = set(i.namespace for i in schema.imports)
ns = {i.namespace for i in schema.imports}
if x and ns and ns - targets:
x.append(schema)
else:
View
@@ -49,6 +49,7 @@
from copy import copy
from datetime import datetime
from decimal import Decimal as _Decimal
from importlib import import_module
import iso8601
import six
@@ -61,11 +62,6 @@
# TODO: Change import we update to iso8601 > 0.1.11 (fixed in 031688e)
from iso8601.iso8601 import UTC, FixedOffset # isort:skip
try:
import importlib
except ImportError:
importlib = None
logger = logging.getLogger(__name__)
@@ -526,10 +522,7 @@ def import_type(type_name):
if '.' not in type_name:
raise ValueError('We need the full namepath to be able to import it: %s' % type_name)
module, name = type_name.rsplit('.', 1)
if importlib:
module = importlib.import_module(module)
else:
module = __import__(module, globals(), {}, [name]) # XXX: Python 2.6
module = import_module(module)
return getattr(module, name)
@@ -880,6 +873,7 @@ def __new__(cls, name, bases, attrs):
return newcls
@functools.total_ordering
class ComplexType(six.with_metaclass(Complex_PythonType, Type)):
'''
Parent for XML elements that have sub-elements.
@@ -909,7 +903,7 @@ def __setattr__(self, attr, value):
raise AttributeError("Model '%s' doesn't have attribute '%s'." % (self.__class__.__name__, attr))
def __str__(self):
fields = dict((f._name, getattr(self, f._name, '<UNKNOWN FIELD>')) for f in self._meta.fields)
fields = {f._name: getattr(self, f._name, '<UNKNOWN FIELD>') for f in self._meta.fields}
str_fields = ', '.join('%s=%s' % item for item in fields.items())
return '<{class_name}: {fields}>'.format(class_name=self.__class__.__name__, fields=str_fields)
@@ -927,21 +921,6 @@ def __lt__(self, other):
return hasattr(self, '_xmlelement') and hasattr(other, '_xmlelement') \
and etree.tostring(self._xmlelement) < etree.tostring(other._xmlelement)
def __gt__(self, other):
# FIXME: We should do this without the conversion back to XML.
return hasattr(self, '_xmlelement') and hasattr(other, '_xmlelement') \
and etree.tostring(self._xmlelement) > etree.tostring(other._xmlelement)
def __le__(self, other):
# FIXME: We should do this without the conversion back to XML.
return hasattr(self, '_xmlelement') and hasattr(other, '_xmlelement') \
and etree.tostring(self._xmlelement) <= etree.tostring(other._xmlelement)
def __ge__(self, other):
# FIXME: We should do this without the conversion back to XML.
return hasattr(self, '_xmlelement') and hasattr(other, '_xmlelement') \
and etree.tostring(self._xmlelement) >= etree.tostring(other._xmlelement)
def __ne__(self, other):
return not self.__eq__(other)
View
@@ -125,11 +125,7 @@ def _cmp(a, b):
# inconclusive, do the same test with their bases
return _cmp(base_a or a, base_b or b)
if hasattr(functools, 'cmp_to_key'):
kw = {'key': functools.cmp_to_key(_cmp)}
else:
kw = {'cmp': _cmp} # XXX: Python < 2.7 and < 3.2
schema.complexTypes.sort(**kw)
schema.complexTypes.sort(key=functools.cmp_to_key(_cmp))
def schema_to_py(schema, xsd_namespaces,
@@ -10,8 +10,7 @@
try:
import django
from django.conf import settings
except (ImportError, SyntaxError):
# XXX: SyntaxError caused by Django 1.8+ on Python 2.6
except ImportError:
django = None
else:
settings.configure(
@@ -27,28 +26,19 @@
from django.conf.urls import url
from django.test import Client
if not hasattr(unittest, 'skip'):
# XXX: Skipping tests not supported in Python 2.6
import unittest2 as unittest
urlconf = namedtuple('urlconf', 'urlpatterns')
@unittest.skipIf(django is None, 'Django is not installed.')
class DjangoDispatchTest(framework.DispatchTestMixin, unittest.TestCase):
def setUp(self): # noqa
# XXX: Python 2.6 and unittest2 still call this method for skipped class.
if django is None:
self.skipTest('Django is not installed.')
self.service = echo_service()
settings.ROOT_URLCONF = urlconf(urlpatterns=(url(r'^ws/$', django_dispatcher(self.service)),))
self.client = Client()
def _prepare_extras(self, headers):
extras = dict(('HTTP_' + k.replace('-', '_').upper(), v) for k, v in headers.items())
extras = {'HTTP_' + k.replace('-', '_').upper(): v for k, v in headers.items()}
extras.update(content_type=headers['content-type'])
return extras
@@ -11,19 +11,11 @@
except ImportError:
flask = None
if not hasattr(unittest, 'skip'):
# XXX: Skipping tests not supported in Python 2.6
import unittest2 as unittest
@unittest.skipIf(flask is None, 'Flask is not installed.')
class FlaskDispatchTest(framework.DispatchTestMixin, unittest.TestCase):
def setUp(self): # noqa
# XXX: Python 2.6 and unittest2 still call this method for skipped class.
if flask is None:
self.skipTest('Flask is not installed.')
self.service = echo_service()
app = flask.Flask(__name__)
app.add_url_rule('/ws/', 'ws', flask_dispatcher(self.service), methods=['GET', 'POST'])
@@ -13,10 +13,6 @@
from soapfish import utils, wsdl2py, xsd
from soapfish.testutil import generated_symbols
if not hasattr(unittest, 'skip'):
# XXX: Skipping tests not supported in Python 2.6
import unittest2 as unittest
class WSDLCodeGenerationTest(PythonicTestCase):
@@ -14,10 +14,6 @@
from soapfish import utils, xsd, xsd2py, xsdspec
from soapfish.testutil import generated_symbols
if not hasattr(unittest, 'skip'):
# XXX: Skipping tests not supported in Python 2.6
import unittest2 as unittest
class XSDCodeGenerationTest(PythonicTestCase):
@@ -46,7 +42,7 @@ def test_can_generate_code_with_xsd_refs_to_simple_elements(self):
assert_contains('Name', symbols.keys())
assert_contains('Job', symbols.keys())
assert_equals(set(['name', 'job']), list(schemas[0].elements))
assert_equals({'job', 'name'}, list(schemas[0].elements))
Job = symbols['Job']
Name = symbols['Name']
@@ -78,7 +74,7 @@ def test_can_generate_code_with_xsd_refs_to_elements_with_anoynmous_complex_type
assert_contains('Person', symbols.keys())
assert_contains('Job', symbols.keys())
assert_equals(set(['person', 'job']), list(schemas[0].elements))
assert_equals({'job', 'person'}, list(schemas[0].elements))
Job = symbols['Job']
Person = symbols['Person']
View
@@ -152,7 +152,7 @@ def test_wsa_inherited_header(self):
header = WsaAppHeader(MessageID='1234', Identity="coucou")
xml = self.SOAP.Envelope.response('GetWeatherByPlaceName', message, header)
expected_xml = (
'<ns0:Envelope xmlns:ns0="{0}">'
'<ns0:Envelope xmlns:ns0="{}">'
'<ns0:Header>'
'<ns0:MessageID xmlns:ns0="http://www.w3.org/2005/08/addressing">1234</ns0:MessageID>'
'<ns0:Identity xmlns:ns0="http://www.example.org">coucou</ns0:Identity>'
View
@@ -1,5 +1,5 @@
[tox]
envlist = py26, py27, py33, py34, py35, py36
envlist = py27, py33, py34, py35, py36
[testenv]
commands = nosetests --nocapture

0 comments on commit 7e41de1

Please sign in to comment.