Skip to content

Commit

Permalink
fix(pylint): remove pylint comments
Browse files Browse the repository at this point in the history
since we are not using it anymore, we don't need the comments
  • Loading branch information
fruch committed Feb 9, 2023
1 parent 973edfe commit 936ae3f
Show file tree
Hide file tree
Showing 254 changed files with 1,426 additions and 1,661 deletions.
4 changes: 2 additions & 2 deletions add_new_dc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Tuple, List

from cassandra import ConsistencyLevel
from cassandra.query import SimpleStatement # pylint: disable=no-name-in-module
from cassandra.query import SimpleStatement

from longevity_test import LongevityTest
from sdcm.cluster import BaseNode
Expand All @@ -17,7 +17,7 @@ class TestAddNewDc(LongevityTest):
https://docs.scylladb.com/operating-scylla/procedures/cluster-management/add-dc-to-existing-dc/
"""

def test_add_new_dc(self) -> None: # pylint: disable=too-many-locals
def test_add_new_dc(self) -> None:

self.log.info("Starting add new DC test...")
assert self.params.get('n_db_nodes').endswith(" 0"), "n_db_nodes must be a list and last dc must equal 0"
Expand Down
5 changes: 2 additions & 3 deletions artifacts_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
}


class ArtifactsTest(ClusterTester): # pylint: disable=too-many-public-methods
class ArtifactsTest(ClusterTester):
REPO_TABLE = "housekeeping.repo"
CHECK_VERSION_TABLE = "housekeeping.checkversion"

Expand Down Expand Up @@ -280,7 +280,6 @@ def check_service_existence(self, service_name):
return False
return True # exit_status = 1 means the service doesn't exist

# pylint: disable=too-many-statements,too-many-branches
def test_scylla_service(self): # noqa: PLR0915
backend = self.params.get("cluster_backend")

Expand Down Expand Up @@ -413,7 +412,7 @@ def get_email_data(self):
email_data = self._get_common_email_data()
try:
node = self.node
except Exception: # pylint: disable=broad-except
except Exception:
node = None
if node:
scylla_packages = node.scylla_packages_installed
Expand Down
2 changes: 1 addition & 1 deletion big_cluster_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Copyright (c) 2016 ScyllaDB

# TODO: this test seem to totally unused, hence disabling all pylint checks
# pylint: disable=all


import logging

Expand Down
6 changes: 2 additions & 4 deletions cdc_replication_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from typing import Optional, Tuple

from cassandra import ConsistencyLevel
from cassandra.query import SimpleStatement # pylint: disable=no-name-in-module
from cassandra.query import SimpleStatement

from sdcm import cluster
from sdcm.tester import ClusterTester
Expand Down Expand Up @@ -132,7 +132,7 @@ def test_replication_longevity(self) -> None:
self.start_replicator(Mode.DELTA)

self.consistency_ok = True
# pylint: disable=unexpected-keyword-arg

self.db_cluster.nemesis.append(CategoricalMonkey(
tester_obj=self, termination_event=self.db_cluster.nemesis_termination_event,
dist={
Expand Down Expand Up @@ -225,8 +225,6 @@ def test_replication_longevity(self) -> None:
# or try to reproduce based on the logs in a smaller test.
self.fail('Consistency check failed.')

# pylint: disable=too-many-statements,too-many-branches,too-many-locals

def test_replication(self, is_gemini_test: bool, mode: Mode) -> None: # noqa: PLR0915
assert is_gemini_test or (mode == Mode.DELTA), "cassandra-stress doesn't work with preimage/postimage modes"

Expand Down
4 changes: 2 additions & 2 deletions cluster_configuration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def test_change_seed_address_to_hostname(self):
addresses = {}
seeds = []
for node in self.db_cluster.nodes:
if hasattr(node._instance, 'public_dns_name'): # pylint: disable=protected-access
addresses[node.private_ip_address] = node._instance.public_dns_name # pylint: disable=protected-access
if hasattr(node._instance, 'public_dns_name'):
addresses[node.private_ip_address] = node._instance.public_dns_name
if node.is_seed:
seeds.append(node.private_ip_address)
else:
Expand Down
2 changes: 1 addition & 1 deletion cql_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_cql_example(self):
node = self.db_cluster.nodes[0]
with self.db_cluster.cql_connection_patient(node) as session:
self.create_keyspace(keyspace_name='ks', replication_factor=1)
# pylint: disable=no-member

session.execute("""
CREATE TABLE test1 (
k int,
Expand Down
2 changes: 1 addition & 1 deletion destroy_data_then_repair_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class CorruptThenRepair(ClusterTester):

def test_destroy_data_then_repair_test_nodes(self): # pylint: disable=invalid-name
def test_destroy_data_then_repair_test_nodes(self):
# populates 100GB
write_queue = self.populate_data_parallel(100, blocking=False)

Expand Down
2 changes: 1 addition & 1 deletion docker/alternator-dns/dns_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def livenodes_update():
# If we're successful, replace livenodes by the new list
livenodes = a
print(livenodes)
except Exception: # pylint: disable=broad-except
except Exception:
# TODO: contacting this ip was unsuccessful, maybe we should
# remove it from the list of live nodes.
pass
Expand Down
18 changes: 9 additions & 9 deletions functional_tests/scylla_operator/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@


@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item, call): # pylint: disable=unused-argument
def pytest_runtest_makereport(item, call):
# Populate test result to test function instance
outcome = yield
rep = outcome.get_result()
if rep.skipped:
item._test_result = ('SKIPPED', rep.longrepr[2]) # pylint: disable=protected-access
TESTER.update_test_status(item.nodeid, *item._test_result) # pylint: disable=protected-access
item._test_result = ('SKIPPED', rep.longrepr[2])
TESTER.update_test_status(item.nodeid, *item._test_result)
elif rep.passed:
item._test_result = ('SUCCESS', None) # pylint: disable=protected-access
item._test_result = ('SUCCESS', None)
elif not rep.passed:
item._test_result = ('FAILED', str(rep.longrepr)) # pylint: disable=protected-access
item._test_result = ('FAILED', str(rep.longrepr))


@pytest.fixture(autouse=True, name="harvest_test_results")
Expand All @@ -63,14 +63,14 @@ def fixture_harvest_test_results(request, tester: ScyllaOperatorFunctionalCluste
def publish_test_result():
tester.update_test_status(
request.node.nodeid,
*request.node._test_result) # pylint: disable=protected-access
*request.node._test_result)

request.addfinalizer(publish_test_result)


@pytest.fixture(autouse=True, scope='package', name="tester")
def fixture_tester() -> ScyllaOperatorFunctionalClusterTester:
global TESTER # pylint: disable=global-statement
global TESTER
os.chdir(sct_abs_path())
tester_inst = ScyllaOperatorFunctionalClusterTester()
TESTER = tester_inst # putting tester global, so we can report skipped test (one with mark.skip)
Expand Down Expand Up @@ -174,7 +174,7 @@ def _bring_cluster_back_to_original_state(
db_cluster.restart_scylla()
db_cluster.wait_for_nodes_up_and_normal(
nodes=db_cluster.nodes, verification_node=db_cluster.nodes[0])
except Exception as exc: # pylint: disable=broad-except
except Exception as exc:
tester.healthy_flag = False
pytest.fail("Failed to bring cluster nodes back to original state due to :\n" +
"".join(traceback.format_exception(type(exc), exc, exc.__traceback__)))
Expand Down Expand Up @@ -223,7 +223,7 @@ def skip_if_not_supported_scylla_version(request: pytest.FixtureRequest,

@pytest.fixture(autouse=True)
def skip_based_on_operator_version(request: pytest.FixtureRequest, tester: ScyllaOperatorFunctionalClusterTester):
# pylint: disable=protected-access

if required_operator := request.node.get_closest_marker('required_operator'):
if (version.LegacyVersion(tester.k8s_cluster._scylla_operator_chart_version.split("-")[0])
< version.LegacyVersion(required_operator.args[0])):
Expand Down
8 changes: 4 additions & 4 deletions functional_tests/scylla_operator/libs/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def scylla_services_names(db_cluster: ScyllaPodCluster) -> list:
if name not in ('NAME', f"{scylla_cluster_name}-client")]


def wait_for_resource_absence(db_cluster: ScyllaPodCluster, # pylint: disable=too-many-arguments # noqa: PLR0913
def wait_for_resource_absence(db_cluster: ScyllaPodCluster, # noqa: PLR0913
resource_type: str, resource_name: str,
namespace: str = SCYLLA_NAMESPACE,
step: int = 2, timeout: int = 60) -> None:
Expand Down Expand Up @@ -158,7 +158,7 @@ def reinstall_scylla_manager(db_cluster: ScyllaPodCluster, manager_version: str)
log.debug(db_cluster.k8s_cluster.helm_install(
target_chart_name="scylla-manager",
source_chart_name="scylla-operator/scylla-manager",
version=db_cluster.k8s_cluster._scylla_operator_chart_version, # pylint: disable=protected-access
version=db_cluster.k8s_cluster._scylla_operator_chart_version,
use_devel=True,
values=values,
namespace=SCYLLA_MANAGER_NAMESPACE,
Expand Down Expand Up @@ -198,7 +198,7 @@ def verify_resharding_on_k8s(db_cluster: ScyllaPodCluster, cpus: Union[str, int,
# One resharding with 100Gb+ may take about 3-4 minutes. So, set 5 minutes timeout per node.
for node, liveness_probe_failures, resharding_start, resharding_finish in nodes_data:
assert wait_for(
func=lambda: list(resharding_start), # pylint: disable=cell-var-from-loop
func=lambda: list(resharding_start),
step=1, timeout=600, throw_exc=False,
text=f"Waiting for the start of resharding on the '{node.name}' node.",
), f"Start of resharding hasn't been detected on the '{node.name}' node."
Expand All @@ -207,7 +207,7 @@ def verify_resharding_on_k8s(db_cluster: ScyllaPodCluster, cpus: Union[str, int,

# Wait for the end of resharding
assert wait_for(
func=lambda: list(resharding_finish), # pylint: disable=cell-var-from-loop
func=lambda: list(resharding_finish),
step=3, timeout=600, throw_exc=False,
text=f"Waiting for the finish of resharding on the '{node.name}' node.",
), f"Finish of the resharding hasn't been detected on the '{node.name}' node."
Expand Down
13 changes: 6 additions & 7 deletions functional_tests/scylla_operator/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import pytest
import yaml
from cassandra.cluster import ( # pylint: disable=no-name-in-module
from cassandra.cluster import (
Cluster,
ExecutionProfile,
EXEC_PROFILE_DEFAULT,
Expand Down Expand Up @@ -312,7 +312,7 @@ def test_check_operator_operability_when_scylla_crd_is_incorrect(db_cluster):
db_cluster.k8s_cluster.helm_install(
target_chart_name=target_chart_name,
source_chart_name="scylla-operator/scylla",
version=db_cluster.k8s_cluster._scylla_operator_chart_version, # pylint: disable=protected-access
version=db_cluster.k8s_cluster._scylla_operator_chart_version,
use_devel=True,
values=values,
namespace=namespace)
Expand Down Expand Up @@ -396,7 +396,7 @@ def change_cluster_spec() -> None:
# NOTE: increase the value only when the sysctl spec update is successful
# to avoid false negative results in further assertions
expected_aio_max_nr_value += 1
except Exception as error: # pylint: disable=broad-except
except Exception as error:
str_error = str(error)
log.debug("Change /spec/sysctls value to %d failed. Error: %s",
expected_aio_max_nr_value, str_error)
Expand Down Expand Up @@ -533,7 +533,7 @@ def test_deploy_helm_with_default_values(db_cluster: ScyllaPodCluster):
log.debug(db_cluster.k8s_cluster.helm_install(
target_chart_name=target_chart_name,
source_chart_name="scylla-operator/scylla",
version=db_cluster.k8s_cluster._scylla_operator_chart_version, # pylint: disable=protected-access
version=db_cluster.k8s_cluster._scylla_operator_chart_version,
use_devel=True,
namespace=namespace,
))
Expand Down Expand Up @@ -598,7 +598,7 @@ def test_rolling_config_change_internode_compression(db_cluster, scylla_yaml):


@pytest.mark.restart_is_used
def test_scylla_yaml_override(db_cluster, scylla_yaml): # pylint: disable=too-many-branches
def test_scylla_yaml_override(db_cluster, scylla_yaml):
"""
Test of applying scylla.yaml via configmap
- update parameter that exists in scylla.yaml
Expand Down Expand Up @@ -700,7 +700,6 @@ def test_default_dns_policy(db_cluster: ScyllaPodCluster):
@pytest.mark.required_operator("v1.8.0")
@pytest.mark.requires_tls
def test_operator_managed_tls(db_cluster: ScyllaPodCluster, tmp_path: path.Path):
# pylint: disable=too-many-locals

cluster_name = db_cluster.k8s_cluster.k8s_scylla_cluster_name

Expand Down Expand Up @@ -728,7 +727,7 @@ def test_operator_managed_tls(db_cluster: ScyllaPodCluster, tmp_path: path.Path)
cluster = Cluster(contact_points=[db_cluster.nodes[0].cql_ip_address], port=db_cluster.nodes[0].CQL_SSL_PORT,
execution_profiles={EXEC_PROFILE_DEFAULT: execution_profile})
ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_SSLv23)
ssl_context.verify_mode = ssl.VerifyMode.CERT_REQUIRED # pylint: disable=no-member
ssl_context.verify_mode = ssl.VerifyMode.CERT_REQUIRED

ssl_context.load_verify_locations(cadata=ca_filename.read_text())
ssl_context.load_cert_chain(keyfile=key_filename, certfile=crt_filename)
Expand Down
2 changes: 1 addition & 1 deletion grow_cluster_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_grow_x_to_y(self):
self.grow_cluster(cluster_target_size=self._cluster_target_size,
stress_cmd=self.get_stress_cmd())

def test_grow_3_to_4_large_partition(self): # pylint: disable=invalid-name
def test_grow_3_to_4_large_partition(self):
"""
Shorter version of the cluster growth test.
Expand Down
2 changes: 1 addition & 1 deletion ics_space_amplification_goal_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _set_enforce_min_threshold_true(self):
node.stop_scylla_server()
node.start_scylla_server()

def test_ics_space_amplification_goal(self): # pylint: disable=too-many-locals
def test_ics_space_amplification_goal(self):
"""
(1) writing new data. wait for compactions to finish.
(2) over-writing existing data.
Expand Down
1 change: 0 additions & 1 deletion longevity_alternator_ttl_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ def test_disable_enable_ttl_scan(self):
4. Wait for TTL-scan intervals to run
5. Run a background read stress while data is being expired.
"""
# pylint: disable=too-many-locals,too-many-branches,too-many-statements

self.db_cluster.add_nemesis(nemesis=self.get_nemesis_class(),
tester_obj=self)
Expand Down
2 changes: 1 addition & 1 deletion longevity_large_partition_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def pre_create_large_partitions_schema(self, compaction_strategy=CompactionStrat
create_table_query = create_scylla_bench_table_query(compaction_strategy=compaction_strategy,
seed=table_setup_seed)
with self.db_cluster.cql_connection_patient(node) as session:
# pylint: disable=no-member

session.execute("""
CREATE KEYSPACE IF NOT EXISTS scylla_bench WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3}
""")
Expand Down
18 changes: 8 additions & 10 deletions longevity_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def test_custom_time(self): # noqa: PLR0912, PLR0915
"""
Run cassandra-stress with params defined in data_dir/scylla.yaml
"""
# pylint: disable=too-many-locals,too-many-branches,too-many-statements

self.db_cluster.add_nemesis(nemesis=self.get_nemesis_class(),
tester_obj=self)
Expand Down Expand Up @@ -142,7 +141,7 @@ def test_custom_time(self): # noqa: PLR0912, PLR0915
profile_dst = os.path.join('/tmp', os.path.basename(cs_profile))
with open(cs_profile, encoding="utf-8") as pconf:
cont = pconf.readlines()
user_profile_table_count = self.params.get( # pylint: disable=invalid-name
user_profile_table_count = self.params.get(
'user_profile_table_count')
for i in range(user_profile_table_count):
for cmd in [line.lstrip('#').strip() for line in cont if line.find('cassandra-stress') > 0]:
Expand Down Expand Up @@ -253,7 +252,7 @@ def test_user_batch_custom_time(self):
assert os.path.exists(cs_profile), 'File not found: {}'.format(cs_profile)
self.log.debug('Run stress test with user profile {}, duration {}'.format(cs_profile, cs_duration))

user_profile_table_count = self.params.get('user_profile_table_count') # pylint: disable=invalid-name
user_profile_table_count = self.params.get('user_profile_table_count')

for _ in range(user_profile_table_count):
stress_params_list += self.create_templated_user_stress_params(next(templated_table_counter),
Expand All @@ -271,7 +270,6 @@ def _run_user_stress_in_batches(self, batch_size, stress_params_list, duration):
:param stress_params_list: the list of all stress commands
:return:
"""
# pylint: disable=too-many-locals

def chunks(_list, chunk_size):
"""Yield successive n-sized chunks from _list."""
Expand Down Expand Up @@ -374,8 +372,8 @@ def _pre_create_schema(self, keyspace_num=1, in_memory=False, scylla_encryption_
compaction=compaction_strategy, sstable_size=sstable_size)

def _pre_create_templated_user_schema(self, batch_start=None, batch_end=None):
# pylint: disable=too-many-locals
user_profile_table_count = self.params.get( # pylint: disable=invalid-name

user_profile_table_count = self.params.get(
'user_profile_table_count') or 0
cs_user_profiles = self.params.get('cs_user_profiles')
# read user-profile
Expand Down Expand Up @@ -431,13 +429,13 @@ def get_email_data(self):

try:
email_data = self._get_common_email_data()
except Exception as error: # pylint: disable=broad-except
except Exception as error:
self.log.exception("Error in gathering common email data: Error:\n%s", error, exc_info=error)

try:
grafana_dataset = self.monitors.get_grafana_screenshot_and_snapshot(
self.start_time) if self.monitors else {}
except Exception as error: # pylint: disable=broad-except
except Exception as error:
self.log.exception("Error in gathering Grafana screenshots and snapshots. Error:\n%s",
error, exc_info=error)

Expand All @@ -453,8 +451,8 @@ def get_email_data(self):
"scylla_ami_id": self.params.get("ami_id_db_scylla") or "-", })
return email_data

def create_templated_user_stress_params(self, idx, cs_profile): # pylint: disable=invalid-name
# pylint: disable=too-many-locals
def create_templated_user_stress_params(self, idx, cs_profile):

params_list = []
cs_duration = self.params.get('cs_duration')

Expand Down
Loading

0 comments on commit 936ae3f

Please sign in to comment.