aboutsummaryrefslogtreecommitdiffstats
path: root/tests/sos_tests.py
diff options
context:
space:
mode:
authorArif Ali <arif.ali@canonical.com>2024-04-12 16:54:30 +0100
committerJake Hunsaker <jacob.r.hunsaker@gmail.com>2024-05-03 15:03:09 -0400
commit5eef0576d6ec2fba042ee1178c2542dcf6a96ca4 (patch)
tree7bb388c7af371e6cada2953017e0e2d9e90e18b0 /tests/sos_tests.py
parent799425b80267fe215f9b9191348c8032deec013c (diff)
downloadsos-5eef0576d6ec2fba042ee1178c2542dcf6a96ca4.tar.gz
[pylint] pylint and flake8 updates
pylint for the following rules applied * C0411: wrong-import-order * R0912: too-many-branches * R0914: too-many-locals * R1725: super-with-arguments * E1101: no-member Resolves: #3597 Signed-off-by: Arif Ali <arif.ali@canonical.com>
Diffstat (limited to 'tests/sos_tests.py')
-rw-r--r--tests/sos_tests.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/tests/sos_tests.py b/tests/sos_tests.py
index 655a9472..a2cca0d9 100644
--- a/tests/sos_tests.py
+++ b/tests/sos_tests.py
@@ -6,13 +6,6 @@
#
# See the LICENSE file in the source distribution for further information.
-
-from avocado.core.exceptions import TestSkipError
-from avocado.core.output import LOG_UI
-from avocado import Test
-from avocado.utils import archive, process, distro, software_manager
-from avocado.utils.cpu import get_arch
-from avocado.utils.software_manager import distro_packages
from fnmatch import fnmatch
import glob
@@ -24,6 +17,13 @@ import shutil
import socket
import re
+from avocado.core.exceptions import TestSkipError
+from avocado.core.output import LOG_UI
+from avocado import Test
+from avocado.utils import archive, process, distro, software_manager
+from avocado.utils.cpu import get_arch
+from avocado.utils.software_manager import distro_packages
+
SOS_TEST_DIR = os.path.dirname(os.path.realpath(__file__))
SOS_REPO_ROOT = os.path.realpath(os.path.join(SOS_TEST_DIR, '../'))
SOS_PLUGIN_DIR = os.path.realpath(
@@ -148,6 +148,8 @@ class BaseSoSTest(Test):
if self._exception_expected:
self.cmd_output = err.result
else:
+ # pylint: disable=no-member
+ # We've already checked above for the result attribute for err
msg = err.result.stderr.decode() or err.result.stdout.decode()
# a little hacky, but using self.log methods here will not
# print to console unless we ratchet up the verbosity for the
@@ -399,6 +401,7 @@ class BaseSoSReportTest(BaseSoSTest):
try:
process.run(cmd, timeout=10)
except Exception as err:
+ # pylint: disable=no-member
if err.result.interrupted:
self.error("Timeout while decrypting")
if 'Bad session key' in err.result.stderr.decode():
@@ -473,7 +476,7 @@ class BaseSoSReportTest(BaseSoSTest):
f"--tmp-dir {self.tmpdir} {self.sos_cmd}")
def _execute_sos_cmd(self):
- super(BaseSoSReportTest, self)._execute_sos_cmd()
+ super()._execute_sos_cmd()
self.archive = re.findall(
'/.*sosreport-.*tar.*',
self.cmd_output.stdout
@@ -489,7 +492,7 @@ class BaseSoSReportTest(BaseSoSTest):
return None
def setUp(self):
- super(BaseSoSReportTest, self).setUp()
+ super().setUp()
self.archive_path = self._get_archive_path()
def get_name_in_archive(self, fname):
@@ -834,12 +837,12 @@ class StageTwoReportTest(BaseSoSReportTest):
self.packages['centos'] = self.packages['rhel']
self.packages['centos-stream'] = self.packages['rhel']
- super(StageTwoReportTest, self).setUp()
+ super().setUp()
def tearDown(self):
if self.end_of_test_case:
self.teardown_mocking()
- super(StageTwoReportTest, self).tearDown()
+ super().tearDown()
def teardown_mocking(self):
"""Undo any and all mocked setup that we did for tests