This is an automated email from the ASF dual-hosted git repository.
kpvdr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-interop-test.git
The following commit(s) were added to refs/heads/main by this push:
new acd8bfc WIP: Removing references to Python 2 in main tests, updating
some code to Python 3 conventions
acd8bfc is described below
commit acd8bfc748723aa39edd18f030bb29dcf71160ca
Author: Kim van der Riet <[email protected]>
AuthorDate: Tue Sep 14 13:56:57 2021 -0400
WIP: Removing references to Python 2 in main tests, updating some code to
Python 3 conventions
---
config.sh.in | 10 +-------
.../qpid_interop_test/amqp_complex_types_test.py | 4 +--
.../amqp_complex_types_test_generator.py | 2 +-
.../qpid_interop_test/amqp_large_content_test.py | 4 +--
src/python/qpid_interop_test/amqp_types_test.py | 8 +++---
.../qpid_interop_test/jms_hdrs_props_test.py | 10 ++++----
src/python/qpid_interop_test/jms_messages_test.py | 6 ++---
src/python/qpid_interop_test/qit_broker_props.py | 2 +-
src/python/qpid_interop_test/qit_common.py | 10 ++------
src/python/qpid_interop_test/qit_shim.py | 29 ++++++----------------
src/python/qpid_interop_test/qit_xunit_log.py | 2 +-
11 files changed, 30 insertions(+), 57 deletions(-)
diff --git a/config.sh.in b/config.sh.in
index fe105c8..2c335bf 100644
--- a/config.sh.in
+++ b/config.sh.in
@@ -20,15 +20,7 @@
export QIT_INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@
-# Set PYTHON2PATH and PYTHON3PATH for respective python shims
-
-unset PYTHON2PATH
-py2_found_str="@PYTHON2_FOUND@"
-if [[ "${py2_found_str#*-}" == "NOTFOUND" ]]; then
- echo "No Python 2.x found, Python 2 shims disabled"
-else
- export
PYTHON2PATH=@CMAKE_INSTALL_PREFIX@/lib64/proton/bindings/python:@CMAKE_INSTALL_PREFIX@/lib/@PYTHON2_SITE_DIR_NAME@/site-packages:@CMAKE_INSTALL_PREFIX@/libexec/qpid_interop_test/shims/qpid-proton-python
-fi
+# Set PYTHON3PATH for respective python shims
unset PYTHON3PATH
py3_found_str="@PYTHON3_FOUND@"
diff --git a/src/python/qpid_interop_test/amqp_complex_types_test.py
b/src/python/qpid_interop_test/amqp_complex_types_test.py
index e68667a..e8e450f 100755
--- a/src/python/qpid_interop_test/amqp_complex_types_test.py
+++ b/src/python/qpid_interop_test/amqp_complex_types_test.py
@@ -190,7 +190,7 @@ class
TestOptions(qpid_interop_test.qit_common.QitCommonTestOptions):
def __init__(self, shim_map, default_timeout=DEFAULT_TEST_TIMEOUT,
default_xunit_dir=qpid_interop_test.qit_xunit_log.DEFUALT_XUNIT_LOG_DIR):
- super(TestOptions, self).__init__('Qpid-interop AMQP client
interoparability test suite for AMQP complex types',
+ super().__init__('Qpid-interop AMQP client interoparability test suite
for AMQP complex types',
shim_map, default_timeout,
default_xunit_dir)
type_group = self._parser.add_mutually_exclusive_group()
type_group.add_argument('--include-type', action='append',
metavar='AMQP-TYPE',
@@ -212,7 +212,7 @@ class
AmqpComplexTypesTest(qpid_interop_test.qit_common.QitTest):
TEST_NAME = 'amqp_complex_types_test'
def __init__(self):
- super(AmqpComplexTypesTest, self).__init__(TestOptions,
AmqpComplexTypes)
+ super().__init__(TestOptions, AmqpComplexTypes)
def _generate_tests(self):
"""Generate tests dynamically"""
diff --git a/src/python/qpid_interop_test/amqp_complex_types_test_generator.py
b/src/python/qpid_interop_test/amqp_complex_types_test_generator.py
index 4e66e34..9524310 100755
--- a/src/python/qpid_interop_test/amqp_complex_types_test_generator.py
+++ b/src/python/qpid_interop_test/amqp_complex_types_test_generator.py
@@ -420,7 +420,7 @@ namespace qpidit {
def __init__(self, target_file_name):
- super(CppGenerator, self).__init__(target_file_name)
+ super().__init__(target_file_name)
self.d32_count = 0
self.d64_count = 0
self.d128_count = 0
diff --git a/src/python/qpid_interop_test/amqp_large_content_test.py
b/src/python/qpid_interop_test/amqp_large_content_test.py
index e9a9eda..2686605 100755
--- a/src/python/qpid_interop_test/amqp_large_content_test.py
+++ b/src/python/qpid_interop_test/amqp_large_content_test.py
@@ -141,7 +141,7 @@ class
TestOptions(qpid_interop_test.qit_common.QitCommonTestOptions):
def __init__(self, shim_map, default_timeout=DEFAULT_TEST_TIMEOUT,
default_xunit_dir=qpid_interop_test.qit_xunit_log.DEFUALT_XUNIT_LOG_DIR):
- super(TestOptions, self).__init__('Qpid-interop AMQP client
interoparability test suite for AMQP' +
+ super().__init__('Qpid-interop AMQP client interoparability test suite
for AMQP' +
' messages with large content',
shim_map, default_timeout, default_xunit_dir)
type_group = self._parser.add_mutually_exclusive_group()
type_group.add_argument('--include-type', action='append',
metavar='AMQP-TYPE',
@@ -157,7 +157,7 @@ class
AmqpLargeContentTest(qpid_interop_test.qit_common.QitTest):
TEST_NAME = 'amqp_large_content_test'
def __init__(self):
- super(AmqpLargeContentTest, self).__init__(TestOptions,
AmqpVariableSizeTypes)
+ super().__init__(TestOptions, AmqpVariableSizeTypes)
def _generate_tests(self):
"""Generate tests dynamically"""
diff --git a/src/python/qpid_interop_test/amqp_types_test.py
b/src/python/qpid_interop_test/amqp_types_test.py
index b0e316f..d4cdfb2 100755
--- a/src/python/qpid_interop_test/amqp_types_test.py
+++ b/src/python/qpid_interop_test/amqp_types_test.py
@@ -232,11 +232,11 @@ class
AmqpPrimitiveTypes(qpid_interop_test.qit_common.QitTestTypeMap):
if test_type == 'binary':
# Convert all binary to base64 strings, as bytes are not JSON
serializable
test_values = []
- bytes_test_values = super(AmqpPrimitiveTypes,
self).get_test_values(test_type)
+ bytes_test_values = super().get_test_values(test_type)
for bytes_test_value in bytes_test_values:
test_values.append(b64encode(bytes_test_value).decode('ascii'))
return test_values
- return super(AmqpPrimitiveTypes, self).get_test_values(test_type)
+ return super().get_test_values(test_type)
class AmqpTypeTestCase(qpid_interop_test.qit_common.QitTestCase):
@@ -295,7 +295,7 @@ class
TestOptions(qpid_interop_test.qit_common.QitCommonTestOptions):
def __init__(self, shim_map, default_timeout=DEFAULT_TEST_TIMEOUT,
default_xunit_dir=qpid_interop_test.qit_xunit_log.DEFUALT_XUNIT_LOG_DIR):
- super(TestOptions, self).__init__('Qpid-interop AMQP client
interoparability test suite for AMQP simple types',
+ super().__init__('Qpid-interop AMQP client interoparability test suite
for AMQP simple types',
shim_map, default_timeout,
default_xunit_dir)
type_group = self._parser.add_mutually_exclusive_group()
type_group.add_argument('--include-type', action='append',
metavar='AMQP-TYPE',
@@ -311,7 +311,7 @@ class AmqpTypesTest(qpid_interop_test.qit_common.QitTest):
TEST_NAME = 'amqp_types_test'
def __init__(self):
- super(AmqpTypesTest, self).__init__(TestOptions, AmqpPrimitiveTypes)
+ super().__init__(TestOptions, AmqpPrimitiveTypes)
def _generate_tests(self):
"""Generate tests dynamically"""
diff --git a/src/python/qpid_interop_test/jms_hdrs_props_test.py
b/src/python/qpid_interop_test/jms_hdrs_props_test.py
index f9a8872..bed085d 100755
--- a/src/python/qpid_interop_test/jms_hdrs_props_test.py
+++ b/src/python/qpid_interop_test/jms_hdrs_props_test.py
@@ -33,7 +33,7 @@ from json import dumps
import qpid_interop_test.qit_common
from qpid_interop_test.qit_errors import InteropTestError, InteropTestTimeout
-from encodings.base64_codec import base64_encode
+# from encodings.base64_codec import base64_encode
DEFAULT_TEST_TIMEOUT = 20 # seconds
@@ -359,8 +359,8 @@ class
TestOptions(qpid_interop_test.qit_common.QitCommonTestOptions):
def __init__(self, shim_map, default_timeout=DEFAULT_TEST_TIMEOUT,
default_xunit_dir=qpid_interop_test.qit_xunit_log.DEFUALT_XUNIT_LOG_DIR):
- super(TestOptions, self).__init__('Qpid-interop AMQP client
interoparability test suite for JMS headers '
- 'and properties', shim_map,
default_timeout, default_xunit_dir)
+ super().__init__('Qpid-interop AMQP client interoparability test suite
for JMS headers '
+ 'and properties', shim_map, default_timeout,
default_xunit_dir)
# Control over JMS message headers
hdrs_group = self._parser.add_mutually_exclusive_group()
@@ -387,7 +387,7 @@ class
JmsHdrsPropsTest(qpid_interop_test.qit_common.QitJmsTest):
TEST_NAME = 'jms_hdrs_props_test'
def __init__(self):
- super(JmsHdrsPropsTest, self).__init__(TestOptions, JmsHdrPropTypes)
+ super().__init__(TestOptions, JmsHdrPropTypes)
def _generate_tests(self):
"""Generate tests dynamically"""
@@ -682,4 +682,4 @@ if __name__ == '__main__':
sys.exit(1) # Errors or failures present
except InteropTestError as err:
print(err)
- exit(1)
+ sys.exit(1)
diff --git a/src/python/qpid_interop_test/jms_messages_test.py
b/src/python/qpid_interop_test/jms_messages_test.py
index 033632c..ebac0f3 100755
--- a/src/python/qpid_interop_test/jms_messages_test.py
+++ b/src/python/qpid_interop_test/jms_messages_test.py
@@ -196,7 +196,7 @@ class
JmsMessageTypes(qpid_interop_test.qit_common.QitTestTypeMap):
Overload the parent method so that binary types can be base64 encoded
for use in json.
The test_type parameter is the JMS message type in this case
"""
- type_map = super(JmsMessageTypes, self).get_test_values(test_type)
+ type_map = super().get_test_values(test_type)
for key in type_map:
if key in ['bytes', 'char']:
new_vals = []
@@ -270,7 +270,7 @@ class
TestOptions(qpid_interop_test.qit_common.QitCommonTestOptions):
def __init__(self, shim_map, default_timeout=DEFAULT_TEST_TIMEOUT,
default_xunit_dir=qpid_interop_test.qit_xunit_log.DEFUALT_XUNIT_LOG_DIR):
- super(TestOptions, self).__init__('Qpid-interop AMQP client
interoparability test suite '
+ super().__init__('Qpid-interop AMQP client interoparability test suite
'
'for JMS message types', shim_map,
default_timeout, default_xunit_dir)
type_group = self._parser.add_mutually_exclusive_group()
type_group.add_argument('--include-type', action='append',
metavar='JMS_MESSAGE-TYPE',
@@ -286,7 +286,7 @@ class
JmsMessagesTest(qpid_interop_test.qit_common.QitJmsTest):
TEST_NAME = 'jms_messages_test'
def __init__(self):
- super(JmsMessagesTest, self).__init__(TestOptions, JmsMessageTypes)
+ super().__init__(TestOptions, JmsMessageTypes)
def _generate_tests(self):
"""Generate tests dynamically"""
diff --git a/src/python/qpid_interop_test/qit_broker_props.py
b/src/python/qpid_interop_test/qit_broker_props.py
index f983c8c..2ebe4c8 100755
--- a/src/python/qpid_interop_test/qit_broker_props.py
+++ b/src/python/qpid_interop_test/qit_broker_props.py
@@ -33,7 +33,7 @@ class Client(proton.handlers.MessagingHandler):
Client to connect to broker and collect connection properties, used to
identify the test broker
"""
def __init__(self, url, max_num_retries):
- super(Client, self).__init__()
+ super().__init__()
self.url = url
self.max_num_retries = max_num_retries
self.num_retries = 0
diff --git a/src/python/qpid_interop_test/qit_common.py
b/src/python/qpid_interop_test/qit_common.py
index 88dcad4..c12e118 100644
--- a/src/python/qpid_interop_test/qit_common.py
+++ b/src/python/qpid_interop_test/qit_common.py
@@ -37,7 +37,6 @@ QIT_INSTALL_PREFIX = getenv('QIT_INSTALL_PREFIX')
if QIT_INSTALL_PREFIX is None:
print('ERROR: Environment variable QIT_INSTALL_PREFIX is not set')
sys.exit(1)
-QIT_ENABLE_PYTHON2_SHIM = getenv('PYTHON2PATH') is not None
QIT_ENABLE_PYTHON3_SHIM = getenv('PYTHON3PATH') is not None
QIT_TEST_SHIM_HOME = path.join(QIT_INSTALL_PREFIX, 'libexec',
'qpid_interop_test', 'shims')
@@ -222,7 +221,7 @@ class QitTestCase(unittest.TestCase):
"""
def __init__(self, methodName='runTest'):
- super(QitTestCase, self).__init__(methodName)
+ super().__init__(methodName)
self.duration = 0
def name(self):
@@ -324,11 +323,6 @@ class QitTest:
# Python shims
proton_python_rcv_shim = path.join(QIT_TEST_SHIM_HOME,
'qpid-proton-python', self.TEST_NAME, 'Receiver.py')
proton_python_snd_shim = path.join(QIT_TEST_SHIM_HOME,
'qpid-proton-python', self.TEST_NAME, 'Sender.py')
- if QIT_ENABLE_PYTHON2_SHIM:
- self.shim_map[qpid_interop_test.qit_shim.ProtonPython2Shim.NAME] =
\
-
qpid_interop_test.qit_shim.ProtonPython2Shim(proton_python_snd_shim,
proton_python_rcv_shim)
- else:
- print('Python 2 shim disabled: no PYTHON2PATH in environment')
if QIT_ENABLE_PYTHON3_SHIM:
self.shim_map[qpid_interop_test.qit_shim.ProtonPython3Shim.NAME] =
\
qpid_interop_test.qit_shim.ProtonPython3Shim(proton_python_snd_shim,
proton_python_rcv_shim)
@@ -418,7 +412,7 @@ class QitJmsTest(QitTest):
def _create_shim_map(self):
"""Create a shim map {'shim_name': <shim_instance>}"""
- super(QitJmsTest, self)._create_shim_map()
+ super()._create_shim_map()
qpid_jms_rcv_shim = 'org.apache.qpid.interop_test.%s.Receiver' %
self.TEST_NAME
qpid_jms_snd_shim = 'org.apache.qpid.interop_test.%s.Sender' %
self.TEST_NAME
diff --git a/src/python/qpid_interop_test/qit_shim.py
b/src/python/qpid_interop_test/qit_shim.py
index 53b31bc..2404754 100644
--- a/src/python/qpid_interop_test/qit_shim.py
+++ b/src/python/qpid_interop_test/qit_shim.py
@@ -39,11 +39,7 @@ class ShimProcess(subprocess.Popen):
if python3_flag:
if 'PYTHON3PATH' in self.env:
self.env['PYTHONPATH'] = self.env['PYTHON3PATH']
- else:
- if 'PYTHON2PATH' in self.env:
- self.env['PYTHONPATH'] = self.env['PYTHON2PATH']
- super(ShimProcess, self).__init__(params, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, preexec_fn=os.setsid,
- env=self.env)
+ super().__init__(params, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, preexec_fn=os.setsid, env=self.env)
def wait_for_completion(self, timeout):
"""Wait for process to end and return tuple containing (stdout,
stderr) from process"""
@@ -90,13 +86,13 @@ class Sender(ShimProcess):
"""Sender shim process"""
def __init__(self, params, python3_flag, proc_name='Sender'):
#print('\n>>>SNDR>>> %s python3_flag=%s' % (params, python3_flag))
- super(Sender, self).__init__(params, python3_flag, proc_name)
+ super().__init__(params, python3_flag, proc_name)
class Receiver(ShimProcess):
"""Receiver shim process"""
def __init__(self, params, python3_flag, proc_name='Receiver'):
#print('\n>>>RCVR>>> %s python3_flag=%s' % (params, python3_flag))
- super(Receiver, self).__init__(params, python3_flag, proc_name)
+ super().__init__(params, python3_flag, proc_name)
class Shim:
"""Abstract shim class, parent of all shims."""
@@ -124,20 +120,11 @@ class Shim:
return Receiver(args, 'Python3' in self.NAME)
-class ProtonPython2Shim(Shim):
- """Shim for qpid-proton Python client"""
- NAME = 'ProtonPython2'
- def __init__(self, sender_shim, receiver_shim):
- super(ProtonPython2Shim, self).__init__(sender_shim, receiver_shim)
- self.send_params = ['python2', self.sender_shim]
- self.receive_params = ['python2', self.receiver_shim]
-
-
class ProtonPython3Shim(Shim):
"""Shim for qpid-proton Python client"""
NAME = 'ProtonPython3'
def __init__(self, sender_shim, receiver_shim):
- super(ProtonPython3Shim, self).__init__(sender_shim, receiver_shim)
+ super().__init__(sender_shim, receiver_shim)
self.send_params = ['python3', self.sender_shim]
self.receive_params = ['python3', self.receiver_shim]
@@ -146,7 +133,7 @@ class ProtonCppShim(Shim):
"""Shim for qpid-proton C++ client"""
NAME = 'ProtonCpp'
def __init__(self, sender_shim, receiver_shim):
- super(ProtonCppShim, self).__init__(sender_shim, receiver_shim)
+ super().__init__(sender_shim, receiver_shim)
self.send_params = [self.sender_shim]
self.receive_params = [self.receiver_shim]
@@ -155,7 +142,7 @@ class RheaJsShim(Shim):
"""Shim for Rhea Javascript client"""
NAME = 'RheaJs'
def __init__(self, sender_shim, receiver_shim):
- super(RheaJsShim, self).__init__(sender_shim, receiver_shim)
+ super().__init__(sender_shim, receiver_shim)
self.send_params = [self.sender_shim]
self.receive_params = [self.receiver_shim]
@@ -169,7 +156,7 @@ class QpidJmsShim(Shim):
JAVA_EXEC = os.path.join(JAVA_HOME, 'bin', 'java')
def __init__(self, dependency_class_path, sender_shim, receiver_shim):
- super(QpidJmsShim, self).__init__(sender_shim, receiver_shim)
+ super().__init__(sender_shim, receiver_shim)
self.dependency_class_path = dependency_class_path
self.send_params = [self.JAVA_EXEC, '-cp', self.get_java_class_path(),
self.sender_shim]
self.receive_params = [self.JAVA_EXEC, '-cp',
self.get_java_class_path(), self.receiver_shim]
@@ -182,6 +169,6 @@ class AmqpNetLiteShim(Shim):
"""Shim for AMQP.Net Lite client"""
NAME = 'AmqpNetLite'
def __init__(self, sender_shim, receiver_shim):
- super(AmqpNetLiteShim, self).__init__(sender_shim, receiver_shim)
+ super().__init__(sender_shim, receiver_shim)
self.send_params = ['dotnet', self.sender_shim]
self.receive_params = ['dotnet', self.receiver_shim]
diff --git a/src/python/qpid_interop_test/qit_xunit_log.py
b/src/python/qpid_interop_test/qit_xunit_log.py
index c512fd3..c10c24e 100644
--- a/src/python/qpid_interop_test/qit_xunit_log.py
+++ b/src/python/qpid_interop_test/qit_xunit_log.py
@@ -71,7 +71,7 @@ class Xunit:
try:
return open(os.path.join(path, file_name), 'w')
except IOError as err:
- raise InteropTestError('Unable to open xUnit log file: %s' % err)
+ raise InteropTestError('Unable to open xUnit log file: %s' % err)
from err
@staticmethod
def _prettify(element):
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]