This is an automated email from the ASF dual-hosted git repository. av pushed a commit to branch ignite-ducktape in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/ignite-ducktape by this push: new f707e43 Ignite ducktape py3 (#8155) f707e43 is described below commit f707e4398a677b88e17bacaa8922ba084f7f3481 Author: Ivan Daschinskiy <ivanda...@gmail.com> AuthorDate: Mon Aug 24 20:41:56 2020 +0300 Ignite ducktape py3 (#8155) * Migrate to python 3 * small fixes * Remove unnecessary python2 compatibility stuff * Remove object inheritance * python3 fix * Migrate to modern super() and refactor some more. * Fix some minors. Set pylint specific version (2.6.0) --- modules/ducktests/tests/docker/Dockerfile | 7 +++-- .../tests/{tox.ini => docker/requirements.txt} | 35 ++-------------------- .../ducktests/tests/ignitetest/services/ignite.py | 11 ++++--- .../tests/ignitetest/services/ignite_app.py | 22 +++++++------- .../ducktests/tests/ignitetest/services/spark.py | 2 +- .../tests/ignitetest/services/utils/concurrent.py | 2 +- .../ignitetest/services/utils/config/ignite.xml.j2 | 4 ++- .../ignitetest/services/utils/control_utility.py | 2 +- .../ignitetest/services/utils/ignite_aware.py | 11 +++---- .../ignitetest/services/utils/ignite_config.py | 8 ++--- .../services/utils/ignite_persistence.py | 10 +++++-- .../tests/ignitetest/services/utils/ignite_spec.py | 12 ++++---- .../tests/ignitetest/services/utils/jmx_utils.py | 8 ++--- .../tests/ignitetest/services/zk/zookeeper.py | 4 +-- .../ignitetest/tests/add_node_rebalance_test.py | 3 -- .../ignitetest/tests/cellular_affinity_test.py | 3 -- .../tests/ignitetest/tests/control_utility_test.py | 2 +- .../tests/ignitetest/tests/discovery_test.py | 5 ++-- .../tests/ignitetest/tests/pme_free_switch_test.py | 3 -- .../ducktests/tests/ignitetest/tests/smoke_test.py | 2 -- modules/ducktests/tests/ignitetest/utils/_mark.py | 7 ++--- .../tests/ignitetest/utils/ignite_test.py | 4 +-- .../ducktests/tests/ignitetest/utils/version.py | 6 ++-- modules/ducktests/tests/setup.py | 5 +++- modules/ducktests/tests/tox.ini | 10 ++----- 25 files changed, 73 insertions(+), 115 deletions(-) diff --git a/modules/ducktests/tests/docker/Dockerfile b/modules/ducktests/tests/docker/Dockerfile index a89ea74..9467da7 100644 --- a/modules/ducktests/tests/docker/Dockerfile +++ b/modules/ducktests/tests/docker/Dockerfile @@ -34,9 +34,10 @@ LABEL ducker.creator=$ducker_creator # Update Linux and install necessary utilities. RUN cat /etc/apt/sources.list | sed 's/http:\/\/deb.debian.org/https:\/\/deb.debian.org/g' > /etc/apt/sources.list.2 && mv /etc/apt/sources.list.2 /etc/apt/sources.list -RUN apt update && apt install -y sudo netcat iptables rsync unzip wget curl jq coreutils openssh-server net-tools vim python-pip python-dev libffi-dev libssl-dev cmake pkg-config libfuse-dev iperf traceroute mc && apt-get -y clean -RUN python -m pip install -U pip==9.0.3; -RUN pip install --upgrade cffi virtualenv pyasn1 boto3 pycrypto pywinrm ipaddress enum34 monotonic && pip install --upgrade ducktape==0.7.8 +RUN apt update && apt install -y sudo netcat iptables rsync unzip wget curl jq coreutils openssh-server net-tools vim python3-pip python3-dev libffi-dev libssl-dev cmake pkg-config libfuse-dev iperf traceroute mc && apt-get -y clean +RUN python3 -m pip install -U pip==20.2.2; +COPY ./requirements.txt /root/requirements.txt +RUN pip3 install -r /root/requirements.txt # Set up ssh COPY ./ssh-config /root/.ssh/config diff --git a/modules/ducktests/tests/tox.ini b/modules/ducktests/tests/docker/requirements.txt similarity index 61% copy from modules/ducktests/tests/tox.ini copy to modules/ducktests/tests/docker/requirements.txt index 60e7012..137f804 100644 --- a/modules/ducktests/tests/tox.ini +++ b/modules/ducktests/tests/docker/requirements.txt @@ -12,36 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -[tox] -envlist = linter -skipsdist = True -[travis] -python = - 3.8: linter - -[testenv] -envdir = {homedir}/.virtualenvs/ignite-ducktests-{envname} -deps = - ducktape==0.7.8 - requests==2.20.0 - monotonic - mock - pytest - pylint==2.5.3 - -[testenv:linter] -basepython = python3.8 -commands = - pylint --rcfile=tox.ini ./ignitetest - -[BASIC] -min-public-methods=0 -# TODO: Remove after migrating to python 3 -disable=R0205 - -[SIMILARITIES] -ignore-imports=yes - -[FORMAT] -max-line-length=120 +pytest==6.0.1 +mock==4.0.2 +git+https://github.com/confluentinc/ducktape diff --git a/modules/ducktests/tests/ignitetest/services/ignite.py b/modules/ducktests/tests/ignitetest/services/ignite.py index 2c85528..2fb64b3 100644 --- a/modules/ducktests/tests/ignitetest/services/ignite.py +++ b/modules/ducktests/tests/ignitetest/services/ignite.py @@ -25,7 +25,7 @@ import time from datetime import datetime from threading import Thread -import monotonic +from time import monotonic from ducktape.cluster.remoteaccount import RemoteCommandError from ducktape.utils.util import wait_until @@ -44,13 +44,12 @@ class IgniteService(IgniteAwareService): # pylint: disable=R0913 def __init__(self, context, num_nodes, jvm_opts=None, properties="", client_mode=False, modules=None, version=DEV_BRANCH): - super(IgniteService, self).__init__(context, num_nodes, properties, - client_mode=client_mode, modules=modules, version=version, - jvm_opts=jvm_opts) + super().__init__(context, num_nodes, properties, client_mode=client_mode, modules=modules, version=version, + jvm_opts=jvm_opts) # pylint: disable=W0221 def start(self, timeout_sec=180): - super(IgniteService, self).start() + super().start() self.logger.info("Waiting for Ignite(s) to start...") @@ -129,7 +128,7 @@ class IgniteService(IgniteAwareService): time.sleep(delay_ms/1000.0) if time_holder: - mono = monotonic.monotonic() + mono = monotonic() timestamp = datetime.now() time_holder.compare_and_set(None, (mono, timestamp)) diff --git a/modules/ducktests/tests/ignitetest/services/ignite_app.py b/modules/ducktests/tests/ignitetest/services/ignite_app.py index 8d60dee..84871d8 100644 --- a/modules/ducktests/tests/ignitetest/services/ignite_app.py +++ b/modules/ducktests/tests/ignitetest/services/ignite_app.py @@ -34,15 +34,15 @@ class IgniteApplicationService(IgniteAwareService): def __init__(self, context, java_class_name, params="", properties="", timeout_sec=60, modules=None, client_mode=True, version=DEV_BRANCH, servicejava_class_name=SERVICE_JAVA_CLASS_NAME, jvm_opts=None, start_ignite=True): - super(IgniteApplicationService, self).__init__(context, 1, properties, - client_mode=client_mode, - version=version, - modules=modules, - servicejava_class_name=servicejava_class_name, - java_class_name=java_class_name, - params=params, - jvm_opts=jvm_opts, - start_ignite=start_ignite) + super().__init__(context, 1, properties, + client_mode=client_mode, + version=version, + modules=modules, + servicejava_class_name=servicejava_class_name, + java_class_name=java_class_name, + params=params, + jvm_opts=jvm_opts, + start_ignite=start_ignite) self.servicejava_class_name = servicejava_class_name self.java_class_name = java_class_name @@ -50,7 +50,7 @@ class IgniteApplicationService(IgniteAwareService): self.stop_timeout_sec = 10 def start(self): - super(IgniteApplicationService, self).start() + super().start() self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name) @@ -61,7 +61,7 @@ class IgniteApplicationService(IgniteAwareService): try: self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True) except Exception: - raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) + raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None # pylint: disable=W0221 def stop_node(self, node, clean_shutdown=True, timeout_sec=20): diff --git a/modules/ducktests/tests/ignitetest/services/spark.py b/modules/ducktests/tests/ignitetest/services/spark.py index a7cb65e..16d90e1 100644 --- a/modules/ducktests/tests/ignitetest/services/spark.py +++ b/modules/ducktests/tests/ignitetest/services/spark.py @@ -39,7 +39,7 @@ class SparkService(BackgroundThreadService, PersistenceAware): :param context: test context :param num_nodes: number of Ignite nodes. """ - super(SparkService, self).__init__(context, num_nodes) + super().__init__(context, num_nodes) self.log_level = "DEBUG" diff --git a/modules/ducktests/tests/ignitetest/services/utils/concurrent.py b/modules/ducktests/tests/ignitetest/services/utils/concurrent.py index 57768bc..99292fd 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/concurrent.py +++ b/modules/ducktests/tests/ignitetest/services/utils/concurrent.py @@ -20,7 +20,7 @@ This module contains concurrent utils. import threading -class CountDownLatch(object): +class CountDownLatch: """ A count-down latch. """ diff --git a/modules/ducktests/tests/ignitetest/services/utils/config/ignite.xml.j2 b/modules/ducktests/tests/ignitetest/services/utils/config/ignite.xml.j2 index 50d2c5c..f03ba17 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/config/ignite.xml.j2 +++ b/modules/ducktests/tests/ignitetest/services/utils/config/ignite.xml.j2 @@ -33,6 +33,8 @@ {% if consistent_id %} <property name="consistentId" value="{{ consistent_id }}"/> {% endif %} - {{ properties }} + {% if properties %} + {{ properties }} + {% endif %} </bean> </beans> diff --git a/modules/ducktests/tests/ignitetest/services/utils/control_utility.py b/modules/ducktests/tests/ignitetest/services/utils/control_utility.py index 2c13301..4b194e6 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/control_utility.py +++ b/modules/ducktests/tests/ignitetest/services/utils/control_utility.py @@ -168,4 +168,4 @@ class ControlUtilityError(RemoteCommandError): Error is raised when control utility failed. """ def __init__(self, account, cmd, exit_status, output): - super(ControlUtilityError, self).__init__(account, cmd, exit_status, "".join(output)) + super().__init__(account, cmd, exit_status, "".join(output)) diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py index 7a608bc..9f374bb 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py @@ -21,15 +21,13 @@ from abc import abstractmethod, ABCMeta from ducktape.services.background_thread import BackgroundThreadService from ducktape.utils.util import wait_until -from six import add_metaclass from ignitetest.services.utils.ignite_spec import resolve_spec from ignitetest.services.utils.jmx_utils import ignite_jmx_mixin from ignitetest.services.utils.ignite_persistence import IgnitePersistenceAware -@add_metaclass(ABCMeta) -class IgniteAwareService(BackgroundThreadService, IgnitePersistenceAware): +class IgniteAwareService(BackgroundThreadService, IgnitePersistenceAware, metaclass=ABCMeta): """ The base class to build services aware of Ignite. """ @@ -39,12 +37,11 @@ class IgniteAwareService(BackgroundThreadService, IgnitePersistenceAware): """ **kwargs are params that passed to IgniteSpec """ - super(IgniteAwareService, self).__init__(context, num_nodes) + super().__init__(context, num_nodes) # Ducktape checks a Service implementation attribute 'logs' to get config for logging. # IgniteAwareService uses IgnitePersistenceAware mixin to override default Service 'log' definition. self.log_level = "DEBUG" - self.logs = IgnitePersistenceAware.logs self.properties = properties @@ -53,7 +50,7 @@ class IgniteAwareService(BackgroundThreadService, IgnitePersistenceAware): def start_node(self, node): self.init_persistent(node) - super(IgniteAwareService, self).start_node(node) + super().start_node(node) wait_until(lambda: len(self.pids(node)) > 0, timeout_sec=10) @@ -64,7 +61,7 @@ class IgniteAwareService(BackgroundThreadService, IgnitePersistenceAware): Init persistent directory. :param node: Ignite service node. """ - super(IgniteAwareService, self).init_persistent(node) + super().init_persistent(node) node_config = self.spec.config().render(config_dir=self.PERSISTENT_ROOT, work_dir=self.WORK_DIR, diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_config.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_config.py index a2bfe3d..6123198 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_config.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_config.py @@ -24,7 +24,7 @@ DEFAULT_CONFIG_PATH = os.path.dirname(os.path.abspath(__file__)) + "/config" DEFAULT_IGNITE_CONF = DEFAULT_CONFIG_PATH + "/ignite.xml.j2" -class Config(object): +class Config: """ Basic configuration. """ @@ -52,7 +52,7 @@ class IgniteServerConfig(Config): Ignite server node configuration. """ def __init__(self, path=DEFAULT_IGNITE_CONF): - super(IgniteServerConfig, self).__init__(path) + super().__init__(path) class IgniteClientConfig(Config): @@ -60,7 +60,7 @@ class IgniteClientConfig(Config): Ignite client node configuration. """ def __init__(self, path=DEFAULT_IGNITE_CONF): - super(IgniteClientConfig, self).__init__(path) + super().__init__(path) self.default_params.update(client_mode=True) @@ -69,4 +69,4 @@ class IgniteLoggerConfig(Config): Ignite logger configuration. """ def __init__(self): - super(IgniteLoggerConfig, self).__init__(DEFAULT_CONFIG_PATH + "/log4j.xml.j2") + super().__init__(DEFAULT_CONFIG_PATH + "/log4j.xml.j2") diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_persistence.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_persistence.py index 9c79b2e..27c3161 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_persistence.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_persistence.py @@ -22,7 +22,7 @@ import os from ignitetest.services.utils.ignite_config import IgniteLoggerConfig -class PersistenceAware(object): +class PersistenceAware: """ This class contains basic persistence artifacts """ @@ -53,12 +53,18 @@ class IgnitePersistenceAware(PersistenceAware): CONFIG_FILE = os.path.join(PersistenceAware.PERSISTENT_ROOT, "ignite-config.xml") LOG4J_CONFIG_FILE = os.path.join(PersistenceAware.PERSISTENT_ROOT, "ignite-log4j.xml") + def __getattribute__(self, item): + if item == 'logs': + return PersistenceAware.logs + + return super().__getattribute__(item) + def init_persistent(self, node): """ Init persistent directory. :param node: Ignite service node. """ - super(IgnitePersistenceAware, self).init_persistent(node) + super().init_persistent(node) logger_config = IgniteLoggerConfig().render(work_dir=self.WORK_DIR) node.account.create_file(self.LOG4J_CONFIG_FILE, logger_config) diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py index 32468a9..f992e3e 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py @@ -54,7 +54,7 @@ def resolve_spec(service, context, **kwargs): raise Exception("There is no specification for class %s" % type(service)) -class IgniteSpec(object): +class IgniteSpec: """ This class is a basic Spec """ @@ -102,8 +102,6 @@ class IgniteNodeSpec(IgniteSpec, IgnitePersistenceAware): """ Spec to run ignite node """ - def __init__(self, **kwargs): - IgniteSpec.__init__(self, **kwargs) def command(self): cmd = "%s %s %s %s 1>> %s 2>> %s &" % \ @@ -122,7 +120,7 @@ class IgniteApplicationSpec(IgniteSpec, IgnitePersistenceAware): Spec to run ignite application """ def __init__(self, **kwargs): - super(IgniteApplicationSpec, self).__init__(**kwargs) + super().__init__(**kwargs) self.args = "" def _app_args(self): @@ -148,7 +146,7 @@ class ApacheIgniteNodeSpec(IgniteNodeSpec, IgnitePersistenceAware): Implementation IgniteNodeSpec for Apache Ignite project """ def __init__(self, modules, **kwargs): - super(ApacheIgniteNodeSpec, self).__init__(project="ignite", **kwargs) + super().__init__(project="ignite", **kwargs) libs = (modules or []) libs.append("log4j") @@ -172,7 +170,7 @@ class ApacheIgniteApplicationSpec(IgniteApplicationSpec, IgnitePersistenceAware) """ # pylint: disable=too-many-arguments def __init__(self, context, modules, servicejava_class_name, java_class_name, params, start_ignite, **kwargs): - super(ApacheIgniteApplicationSpec, self).__init__(project="ignite", **kwargs) + super().__init__(project="ignite", **kwargs) self.context = context libs = modules or [] @@ -201,7 +199,7 @@ class ApacheIgniteApplicationSpec(IgniteApplicationSpec, IgnitePersistenceAware) str(start_ignite), java_class_name, self.CONFIG_FILE, - str(base64.b64encode(json.dumps(params).encode("UTF-8"))) + str(base64.b64encode(json.dumps(params).encode('utf-8')), 'utf-8') ] def __jackson(self): diff --git a/modules/ducktests/tests/ignitetest/services/utils/jmx_utils.py b/modules/ducktests/tests/ignitetest/services/utils/jmx_utils.py index bfbab25..925034b 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/jmx_utils.py +++ b/modules/ducktests/tests/ignitetest/services/utils/jmx_utils.py @@ -35,7 +35,7 @@ def ignite_jmx_mixin(node, pids): node.__class__ = type(base_cls_name, (base_cls, IgniteJmxMixin), {}) -class JmxMBean(object): +class JmxMBean: """ Dynamically exposes JMX MBean attributes. """ @@ -52,7 +52,7 @@ class JmxMBean(object): return self.client.mbean_attribute(self.name, attr) -class JmxClient(object): +class JmxClient: """JMX client, invokes jmxterm on node locally. """ jmx_util_cmd = 'java -jar /opt/jmxterm.jar -v silent -n' @@ -92,7 +92,7 @@ class JmxClient(object): return self.node.account.ssh_capture(cmd, allow_fail=False, callback=str) -class DiscoveryInfo(object): +class DiscoveryInfo: """ Ignite service node discovery info, obtained from DiscoverySpi mbean. """ def __init__(self, coordinator, local_raw): @@ -147,7 +147,7 @@ class DiscoveryInfo(object): return res.group(1) if res else None -class IgniteJmxMixin(object): +class IgniteJmxMixin: """ Mixin to IgniteService node, exposing useful properties, obtained from JMX. """ diff --git a/modules/ducktests/tests/ignitetest/services/zk/zookeeper.py b/modules/ducktests/tests/ignitetest/services/zk/zookeeper.py index f4a0158..b3da642 100644 --- a/modules/ducktests/tests/ignitetest/services/zk/zookeeper.py +++ b/modules/ducktests/tests/ignitetest/services/zk/zookeeper.py @@ -54,12 +54,12 @@ class ZookeeperService(Service): } def __init__(self, context, num_nodes, settings=ZookeeperSettings(), start_timeout_sec=60): - super(ZookeeperService, self).__init__(context, num_nodes) + super().__init__(context, num_nodes) self.settings = settings self.start_timeout_sec = start_timeout_sec def start(self): - super(ZookeeperService, self).start() + super().start() self.logger.info("Waiting for Zookeeper quorum...") for node in self.nodes: diff --git a/modules/ducktests/tests/ignitetest/tests/add_node_rebalance_test.py b/modules/ducktests/tests/ignitetest/tests/add_node_rebalance_test.py index 0eebea8..a1d90b8 100644 --- a/modules/ducktests/tests/ignitetest/tests/add_node_rebalance_test.py +++ b/modules/ducktests/tests/ignitetest/tests/add_node_rebalance_test.py @@ -36,9 +36,6 @@ class AddNodeRebalanceTest(IgniteTest): DATA_AMOUNT = 1000000 REBALANCE_TIMEOUT = 60 - def __init__(self, test_context): - super(AddNodeRebalanceTest, self).__init__(test_context=test_context) - def setUp(self): pass diff --git a/modules/ducktests/tests/ignitetest/tests/cellular_affinity_test.py b/modules/ducktests/tests/ignitetest/tests/cellular_affinity_test.py index 718d5da..78d3eba 100644 --- a/modules/ducktests/tests/ignitetest/tests/cellular_affinity_test.py +++ b/modules/ducktests/tests/ignitetest/tests/cellular_affinity_test.py @@ -68,9 +68,6 @@ class CellularAffinity(IgniteTest): attr=CellularAffinity.ATTRIBUTE, cacheName=CellularAffinity.CACHE_NAME) - def __init__(self, test_context): - super(CellularAffinity, self).__init__(test_context=test_context) - def setUp(self): pass diff --git a/modules/ducktests/tests/ignitetest/tests/control_utility_test.py b/modules/ducktests/tests/ignitetest/tests/control_utility_test.py index f2c1a4c..63c87ac 100644 --- a/modules/ducktests/tests/ignitetest/tests/control_utility_test.py +++ b/modules/ducktests/tests/ignitetest/tests/control_utility_test.py @@ -62,7 +62,7 @@ class BaselineTests(IgniteTest): .render(version=version) def __init__(self, test_context): - super(BaselineTests, self).__init__(test_context) + super().__init__(test_context) self.servers = None @cluster(num_nodes=NUM_NODES) diff --git a/modules/ducktests/tests/ignitetest/tests/discovery_test.py b/modules/ducktests/tests/ignitetest/tests/discovery_test.py index ee94d2c..8aec38f 100644 --- a/modules/ducktests/tests/ignitetest/tests/discovery_test.py +++ b/modules/ducktests/tests/ignitetest/tests/discovery_test.py @@ -60,7 +60,7 @@ class DiscoveryTest(IgniteTest): """ def __init__(self, test_context): - super(DiscoveryTest, self).__init__(test_context=test_context) + super().__init__(test_context=test_context) self.zk_quorum = None self.servers = None @@ -206,7 +206,8 @@ class DiscoveryTest(IgniteTest): "grep '%s' %s" % (self.__failed_pattern(failed_id), IgniteAwareService.STDOUT_STDERR_CAPTURE)) logged_timestamps.append( - datetime.strptime(re.match("^\\[[^\\[]+\\]", stdout.read()).group(), "[%Y-%m-%d %H:%M:%S,%f]")) + datetime.strptime(re.match("^\\[[^\\[]+\\]", stdout.read().decode("utf-8")).group(), + "[%Y-%m-%d %H:%M:%S,%f]")) logged_timestamps.sort(reverse=True) diff --git a/modules/ducktests/tests/ignitetest/tests/pme_free_switch_test.py b/modules/ducktests/tests/ignitetest/tests/pme_free_switch_test.py index 774ab41..ea266c3 100644 --- a/modules/ducktests/tests/ignitetest/tests/pme_free_switch_test.py +++ b/modules/ducktests/tests/ignitetest/tests/pme_free_switch_test.py @@ -53,9 +53,6 @@ class PmeFreeSwitchTest(IgniteTest): </property> """ - def __init__(self, test_context): - super(PmeFreeSwitchTest, self).__init__(test_context=test_context) - def setUp(self): pass diff --git a/modules/ducktests/tests/ignitetest/tests/smoke_test.py b/modules/ducktests/tests/ignitetest/tests/smoke_test.py index a8dfc87..48965e3 100644 --- a/modules/ducktests/tests/ignitetest/tests/smoke_test.py +++ b/modules/ducktests/tests/ignitetest/tests/smoke_test.py @@ -32,8 +32,6 @@ class SmokeServicesTest(IgniteTest): """ Tests services implementations """ - def __init__(self, test_context): - super(SmokeServicesTest, self).__init__(test_context=test_context) def setUp(self): pass diff --git a/modules/ducktests/tests/ignitetest/utils/_mark.py b/modules/ducktests/tests/ignitetest/utils/_mark.py index c4b2b35..7387d50 100644 --- a/modules/ducktests/tests/ignitetest/utils/_mark.py +++ b/modules/ducktests/tests/ignitetest/utils/_mark.py @@ -16,7 +16,6 @@ """ Module contains useful test decorators. """ -import six from ducktape.mark._mark import Ignore, Mark from ignitetest.utils.version import IgniteVersion @@ -27,7 +26,7 @@ class VersionIf(Ignore): Ignore test if version doesn't corresponds to condition. """ def __init__(self, condition): - super(VersionIf, self).__init__() + super().__init__() self.condition = condition def apply(self, seed_context, context_list): @@ -36,13 +35,13 @@ class VersionIf(Ignore): for ctx in context_list: assert 'version' in ctx.injected_args, "'version' in injected args not present" version = ctx.injected_args['version'] - assert isinstance(version, six.string_types), "'version' in injected args must be a string" + assert isinstance(version, str), "'version' in injected args must be a string" ctx.ignore = ctx.ignore or not self.condition(IgniteVersion(version)) return context_list def __eq__(self, other): - return super(VersionIf, self).__eq__(other) and self.condition == other.condition + return super().__eq__(other) and self.condition == other.condition def version_if(condition): diff --git a/modules/ducktests/tests/ignitetest/utils/ignite_test.py b/modules/ducktests/tests/ignitetest/utils/ignite_test.py index c0c35c7..a4bfe7d 100644 --- a/modules/ducktests/tests/ignitetest/utils/ignite_test.py +++ b/modules/ducktests/tests/ignitetest/utils/ignite_test.py @@ -16,9 +16,9 @@ """ This module contains basic ignite test. """ +from time import monotonic from ducktape.tests.test import Test -from monotonic import monotonic # pylint: disable=W0223 @@ -27,7 +27,7 @@ class IgniteTest(Test): Basic ignite test. """ def __init__(self, test_context): - super(IgniteTest, self).__init__(test_context=test_context) + super().__init__(test_context=test_context) def stage(self, msg): """ diff --git a/modules/ducktests/tests/ignitetest/utils/version.py b/modules/ducktests/tests/ignitetest/utils/version.py index 5131b47..0454597 100644 --- a/modules/ducktests/tests/ignitetest/utils/version.py +++ b/modules/ducktests/tests/ignitetest/utils/version.py @@ -44,15 +44,13 @@ class IgniteVersion(LooseVersion): if dev_suffix_index >= 0: version_string = version_string[:dev_suffix_index] - # Don't use the form super.(...).__init__(...) because - # LooseVersion is an "old style" python class - LooseVersion.__init__(self, version_string) + super().__init__(version_string) def __str__(self): if self.is_dev: return "dev" - return LooseVersion.__str__(self) + return super().__str__() def __repr__(self): return "IgniteVersion ('%s')" % str(self) diff --git a/modules/ducktests/tests/setup.py b/modules/ducktests/tests/setup.py index 8ad70b0..76dd815 100644 --- a/modules/ducktests/tests/setup.py +++ b/modules/ducktests/tests/setup.py @@ -30,5 +30,8 @@ setup(name="ignitetest", license="apache2.0", packages=find_packages(exclude=["ignitetest.tests", "ignitetest.tests.*"]), include_package_data=True, - install_requires=["ducktape==0.7.8", "requests==2.22.0", "monotonic==1.5"] + install_requires=['ducktape==0.8.0'], + dependency_links = [ + 'https://github.com/confluentinc/ducktape/tarball/master#egg=ducktape-0.8.0' + ] ) diff --git a/modules/ducktests/tests/tox.ini b/modules/ducktests/tests/tox.ini index 60e7012..45107be 100644 --- a/modules/ducktests/tests/tox.ini +++ b/modules/ducktests/tests/tox.ini @@ -23,12 +23,8 @@ python = [testenv] envdir = {homedir}/.virtualenvs/ignite-ducktests-{envname} deps = - ducktape==0.7.8 - requests==2.20.0 - monotonic - mock - pytest - pylint==2.5.3 + -r ./docker/requirements.txt + pylint==2.6.0 [testenv:linter] basepython = python3.8 @@ -37,8 +33,6 @@ commands = [BASIC] min-public-methods=0 -# TODO: Remove after migrating to python 3 -disable=R0205 [SIMILARITIES] ignore-imports=yes