diff --git a/tests/monitors/diskio/diskio_test.py b/tests/monitors/diskio/diskio_test.py index 458475b4f9..94db53f7b1 100644 --- a/tests/monitors/diskio/diskio_test.py +++ b/tests/monitors/diskio/diskio_test.py @@ -27,7 +27,7 @@ def test_diskio(): "disk_ops.pending", ] ) - elif sys.platform == "win32" or sys.platform == "cygwin": + elif sys.platform in ("win32", "cygwin"): expected_metrics.extend( [ "disk_ops.avg_read", diff --git a/tests/monitors/http/http_test.py b/tests/monitors/http/http_test.py index 78cfb28179..cb4e39cf37 100644 --- a/tests/monitors/http/http_test.py +++ b/tests/monitors/http/http_test.py @@ -45,7 +45,7 @@ def check_values(dps, status_code, code=1, regex=1, cert=1): assert dp.value.intValue == regex if dp.metric == METRIC_CODE_MATCH: assert dp.value.intValue > 0 or code - if dp.metric == METRIC_TIME or dp.metric == METRIC_CERT_EXPIRY: + if dp.metric in (METRIC_TIME, METRIC_CERT_EXPIRY): assert dp.value.doubleValue > 0 diff --git a/tests/monitors/logstash/logstash_test.py b/tests/monitors/logstash/logstash_test.py index 84f72a7156..d6c436d8a2 100644 --- a/tests/monitors/logstash/logstash_test.py +++ b/tests/monitors/logstash/logstash_test.py @@ -39,7 +39,7 @@ def test_logstash_tcp_client(version): ) as logstash_cont: copy_file_content_into_container(SAMPLE_EVENTS, logstash_cont, "tmp/events.log") copy_file_content_into_container( - PIPELINE_CONF.read_text(), logstash_cont, "/usr/share/logstash/pipeline/test.conf" + PIPELINE_CONF.read_text(encoding="utf-8"), logstash_cont, "/usr/share/logstash/pipeline/test.conf" ) host = container_ip(logstash_cont) diff --git a/tests/monitors/logstash_tcp/logstash_tcp_test.py b/tests/monitors/logstash_tcp/logstash_tcp_test.py index 838f3229ff..46156d3ae0 100644 --- a/tests/monitors/logstash_tcp/logstash_tcp_test.py +++ b/tests/monitors/logstash_tcp/logstash_tcp_test.py @@ -43,7 +43,7 @@ def test_logstash_tcp_client(version): ) as logstash_cont: copy_file_content_into_container(SAMPLE_EVENTS, logstash_cont, "tmp/events.log") copy_file_content_into_container( - PIPELINE_CONF.read_text(), logstash_cont, "/usr/share/logstash/pipeline/test.conf" + PIPELINE_CONF.read_text(encoding="utf-8"), logstash_cont, "/usr/share/logstash/pipeline/test.conf" ) host = container_ip(logstash_cont) @@ -95,7 +95,7 @@ def test_logstash_tcp_server(version): copy_file_content_into_container( # The pipeline conf is written for server mode so patch it to # act as a client. - PIPELINE_CONF.read_text() + PIPELINE_CONF.read_text(encoding="utf-8") .replace('mode => "server"', 'mode => "client"') .replace('host => "0.0.0.0"', f'host => "{agent_host}"') .replace("port => 8900", f"port => {listen_port}"), diff --git a/tests/monitors/vmem/vmem_test.py b/tests/monitors/vmem/vmem_test.py index 6fab22e854..70b06b0fb9 100644 --- a/tests/monitors/vmem/vmem_test.py +++ b/tests/monitors/vmem/vmem_test.py @@ -25,7 +25,7 @@ "vmpage_number.shmem_pmdmapped", } ) -elif sys.platform == "win32" or sys.platform == "cygwin": +elif sys.platform in ("win32", "cygwin"): METRICS.update({"vmpage.swap.in_per_second", "vmpage.swap.out_per_second", "vmpage.swap.total_per_second"}) diff --git a/tests/pylintrc b/tests/pylintrc index 212e81a3b4..a0551e2bcd 100644 --- a/tests/pylintrc +++ b/tests/pylintrc @@ -141,6 +141,7 @@ disable=print-statement, ungrouped-imports, f-string-without-interpolation, duplicate-code, + consider-using-f-string, bad-continuation # We use black so this shouldn't ever be relevant # Enable the message, report, category or checker with the given id(s). You can diff --git a/tests/requirements.txt b/tests/requirements.txt index a2010846b3..527ce1265e 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -7,7 +7,7 @@ mysql-connector-python==8.0.27 netifaces==0.11.0 protobuf==3.19.1 psutil==5.8.0 -pylint==2.10.2 +pylint==2.12.2 pytest-html==3.1.1 pytest-rerunfailures==10.2 pytest-xdist==2.5.0