You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jd...@apache.org on 2023/04/10 21:13:58 UTC
[qpid-python] branch main updated: QPID-8631: make the `qpid-python-test` script Python 3 compatible (#14)
This is an automated email from the ASF dual-hosted git repository.
jdanek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-python.git
The following commit(s) were added to refs/heads/main by this push:
new d0050c6 QPID-8631: make the `qpid-python-test` script Python 3 compatible (#14)
d0050c6 is described below
commit d0050c6e3f80133f41e9bbcccaf3a2a7bde0c34b
Author: Jiri Daněk <jd...@redhat.com>
AuthorDate: Mon Apr 10 23:13:53 2023 +0200
QPID-8631: make the `qpid-python-test` script Python 3 compatible (#14)
This takes inspiration from the PROTON-490 changes done in the Qpid Proton Python client.
---
qpid-python-test | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/qpid-python-test b/qpid-python-test
index fef140b..f877c03 100755
--- a/qpid-python-test
+++ b/qpid-python-test
@@ -29,6 +29,11 @@ from logging import getLogger, StreamHandler, Formatter, Filter, \
from qpid.harness import Skipped
from qpid.util import URL
+if sys.version_info.major == 3:
+ CLASS_TYPES = (type,)
+else:
+ CLASS_TYPES = (type, types.ClassType)
+
levels = {
"DEBUG": DEBUG,
"WARN": WARN,
@@ -502,7 +507,7 @@ class FunctionScanner(PatternMatcher):
class ClassScanner(PatternMatcher):
def inspect(self, obj):
- return type(obj) in (types.ClassType, types.TypeType) and self.matches(obj.__name__)
+ return type(obj) in CLASS_TYPES and self.matches(obj.__name__)
def descend(self, cls):
# the None is required for older versions of python
@@ -514,7 +519,7 @@ class ClassScanner(PatternMatcher):
for name in names:
obj = getattr(cls, name)
t = type(obj)
- if t == types.MethodType and name.startswith("test"):
+ if hasattr(obj, '__call__') and name.startswith("test"):
yield MethodTest(cls, name)
class ModuleScanner:
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org