Skip to content

Commit

Permalink
Merge pull request #87 from cjmayo/six
Browse files Browse the repository at this point in the history
Remove Python version checks and use of six in tests
  • Loading branch information
phillbaker committed Nov 9, 2022
2 parents bf1a78a + 9dabda9 commit dcf5d3d
Show file tree
Hide file tree
Showing 23 changed files with 305 additions and 456 deletions.
20 changes: 0 additions & 20 deletions HACKING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Separate sections below:
* `PYTHON COMPATIBILITY`_
* `RELEASE PROCEDURE`_
* `DEVELOPMENT & TESTING ENVIRONMENT`_
* `PYTHON 2/3 SOURCE CODE COMPATIBILITY`_
* `EXTERNAL DOCUMENTATION`_
* `STANDARDS CONFORMANCE`_
* `PROJECT IMPLEMENTATION NOTES`_
Expand Down Expand Up @@ -551,25 +550,6 @@ entries manually, e.g. by using a script similar to the one found at
`<http://nedbatchelder.com/blog/201007/installing_python_packages_from_windows_installers_into.html>`_.


PYTHON 2/3 SOURCE CODE COMPATIBILITY
=================================================

These are notes related to maintaining Python 2/3 source code compatibility in
parts of this project that require it.

Use the ``six <http://pythonhosted.org/six>`` Python 2/3 compatibility support
package to make the compatibility patches simpler. Where a solution provided by
``six`` can not be used, explicitly explain the reason why in a related code
comment.

Do not use ``u"..."`` Python unicode literals since we wish to support Python
3.1 & 3.2 versions which do not support them. Useful site for easily converting
unicode strings to their ``unicode-escape`` encoded representation which can
then be used with the ``six.u()`` helper function:

http://www.rapidmonkey.com/unicodeconverter


EXTERNAL DOCUMENTATION
=================================================

Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
sys.path.pop(0)

from suds_devel.requirements import (check_Python24_pytest_requirements,
pytest_requirements, six_requirements)
pytest_requirements)


# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -482,7 +482,6 @@ def test_requirements():
result = []
if include_pytest_requirements:
result.extend(pytest_requirements())
result.extend(six_requirements())
return result

test_error = None
Expand Down
2 changes: 1 addition & 1 deletion tests/external/axis1.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def start(url):
#
print('create name')
name = client.factory.create('ns0:Name')
name.first = u'jeff'+unichr(1234)
name.first = u'jeff'+chr(1234)
name.last = 'ortel'
print(name)
#
Expand Down
2 changes: 1 addition & 1 deletion tests/external/axis2.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#
print('create name')
name = client.factory.create('ns2:Name')
name.first = u'jeff'+unichr(1234)
name.first = u'jeff'+chr(1234)
name.last = 'ortel'

print(name)
Expand Down
2 changes: 1 addition & 1 deletion tests/external/rhq.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def rhqTest():
# create name
#
name = client.factory.create('name')
name.first = u'Jeff'+unichr(1234)
name.first = u'Jeff'+chr(1234)
name.last = 'Ortel &amp;lt; Company'
#
# create a phone object using the wsdl
Expand Down
23 changes: 11 additions & 12 deletions tests/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import suds.sax.parser

import pytest
from six import b, next, u

import datetime
import os
Expand Down Expand Up @@ -163,18 +162,18 @@ def reset(self):


# Hardcoded values used in different caching test cases.
value_empty = b("")
value_f2 = b("fifi2")
value_f22 = b("fifi22")
value_f3 = b("fifi3")
value_p1 = b("pero1")
value_p11 = b("pero11")
value_p111 = b("pero111")
value_p2 = b("pero2")
value_p22 = b("pero22")
value_unicode = u("\u20AC \u7684 "
value_empty = b""
value_f2 = b"fifi2"
value_f22 = b"fifi22"
value_f3 = b"fifi3"
value_p1 = b"pero1"
value_p11 = b"pero11"
value_p111 = b"pero111"
value_p2 = b"pero2"
value_p22 = b"pero22"
value_unicode = ("\u20AC \u7684 "
"\u010D\u0107\u017E\u0161\u0111"
"\u010C\u0106\u017D\u0160\u0110").encode("utf-8")
"\u010C\u0106\u017D\u0160\u0110").encode()


# FileCache item expiration test data - duration, current_time, expect_remove.
Expand Down

0 comments on commit dcf5d3d

Please sign in to comment.