Enable real testing of python 3.4

The gate 34 tests were not running any tests because there was no
tox target. This changes tox-tmpl.ini (and the resulting tox.ini) to
add support for python 34 and remove support for anything that is
not py34 or py27-based.

To make the python3 tox environments work, the remote zip of a suds
fork has been replaced with suds-jurko, a relatively modern fork of
the original suds that supports python2 and 3.

Some tests needed to be fixed to deal with two main problems:

* reponse bodies being bytes
* Exceptions not having a .message attribute (.args[0] is used
  instead)
* the test_flask tests were not being run for python3, they are now
* wsmeext/sphinxext.py intermittently fails due to the dictionary
  changing size in flight, getting the keys prior to iteration fixes
  it

Both 27 and 34 should be running 420 tests as of this commit.

Change-Id: I837c249714fd957790ea84aa2fd9ad994a39c5ea
This commit is contained in:
Chris Dent
2015-04-28 12:30:11 +01:00
parent c46e2b102e
commit 78d6b89d18
8 changed files with 176 additions and 737 deletions

View File

@@ -180,7 +180,7 @@ class TestWS(FunctionalTest):
'/authors/913',
)
self.assertEqual(res.status_int, 200)
self.assertEqual(res.body, '"foo"')
self.assertEqual(res.body, b'"foo"')
self.assertEqual(res.content_length, 5)
def test_non_default_response_return_type_no_content(self):
@@ -188,7 +188,7 @@ class TestWS(FunctionalTest):
'/authors/912',
)
self.assertEqual(res.status_int, 204)
self.assertEqual(res.body, '')
self.assertEqual(res.body, b'')
self.assertEqual(res.content_length, 0)
def test_serversideerror(self):

View File

@@ -105,7 +105,7 @@ class FlaskrTestCase(unittest.TestCase):
def test_multiply(self):
r = self.app.get('/multiply?a=2&b=5')
assert r.data == '10'
assert r.data == b'10', r.data
def test_get_model(self):
resp = self.app.get('/models/test')
@@ -118,9 +118,8 @@ class FlaskrTestCase(unittest.TestCase):
def test_array_parameter(self):
resp = self.app.get('/models?q.op=%3D&q.attr=name&q.value=second')
assert resp.status_code == 200
print resp.data
self.assertEquals(
resp.data, '[{"name": "second"}]'
resp.data, b'[{"name": "second"}]'
)
def test_post_model(self):
@@ -154,9 +153,9 @@ class FlaskrTestCase(unittest.TestCase):
headers={'Accept': 'application/xml'}
)
assert r.status_code == 403, r.status_code
assert r.data == ('<error><faultcode>Client</faultcode>'
'<faultstring>403: Forbidden</faultstring>'
'<debuginfo /></error>')
assert r.data == (b'<error><faultcode>Client</faultcode>'
b'<faultstring>403: Forbidden</faultstring>'
b'<debuginfo /></error>')
def test_custom_non_http_clientside_error(self):
r = self.app.get(
@@ -171,20 +170,17 @@ class FlaskrTestCase(unittest.TestCase):
headers={'Accept': 'application/xml'}
)
assert r.status_code == 412, r.status_code
assert r.data == ('<error><faultcode>Client</faultcode>'
'<faultstring>FOO!</faultstring>'
'<debuginfo /></error>')
assert r.data == (b'<error><faultcode>Client</faultcode>'
b'<faultstring>FOO!</faultstring>'
b'<debuginfo /></error>')
def test_serversideerror(self):
r = self.app.get('/divide_by_zero')
assert r.status_code == 500
data = json.loads(r.data)
self.assertEquals(
data,
{"debuginfo": None,
"faultcode": "Server",
"faultstring": "integer division or modulo by zero"}
)
self.assertEquals(data['debuginfo'], None)
self.assertEquals(data['faultcode'], 'Server')
self.assertIn('by zero', data['faultstring'])
def test_restful_get(self):
r = self.app.get('/restful', headers={'Accept': 'application/json'})