Skip to content

Commit cfbcd59

Browse files
tomjelinekrichm
authored andcommitted
style: address linter issues
1 parent 2e5edc9 commit cfbcd59

File tree

4 files changed

+23
-45
lines changed

4 files changed

+23
-45
lines changed

library/ha_cluster_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113

114114
try:
115115
# firewall module doesn't provide type hints
116-
from firewall.client import FirewallClient # type:ignore
116+
from firewall.client import FirewallClient # type: ignore
117117

118118
HAS_FIREWALL = True
119119
except ImportError:

tests/unit/test_ha_cluster_os.py

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,15 @@ class ExportOsConfiguration(TestCase):
2828
@mock.patch("ha_cluster_info.HAS_FIREWALL", False)
2929
@mock.patch("ha_cluster_info.HAS_SELINUX", False)
3030
def test_packages_rhel_1(self) -> None:
31-
dnf_repolist = dedent(
32-
"""\
31+
dnf_repolist = dedent("""\
3332
repo1id Repository 1
3433
highavailability Repository HA Addon
3534
repo2id Repository 2
36-
"""
37-
)
38-
rpm_packages = dedent(
39-
"""\
35+
""")
36+
rpm_packages = dedent("""\
4037
package1
4138
package2
42-
"""
43-
)
39+
""")
4440
with mocked_module(
4541
[
4642
(CMD_DNF_REPORTLIST, (0, dnf_repolist, "")),
@@ -60,20 +56,16 @@ def test_packages_rhel_1(self) -> None:
6056
@mock.patch("ha_cluster_info.HAS_FIREWALL", False)
6157
@mock.patch("ha_cluster_info.HAS_SELINUX", False)
6258
def test_packages_rhel_2(self) -> None:
63-
dnf_repolist = dedent(
64-
"""\
59+
dnf_repolist = dedent("""\
6560
repo1id Repository 1
6661
resilientstorage RS repository
6762
repo2id Repository 2
68-
"""
69-
)
70-
rpm_packages = dedent(
71-
"""\
63+
""")
64+
rpm_packages = dedent("""\
7265
package1
7366
resource-agents-cloud
7467
package2
75-
"""
76-
)
68+
""")
7769
with mocked_module(
7870
[
7971
(CMD_DNF_REPORTLIST, (0, dnf_repolist, "")),
@@ -93,13 +85,11 @@ def test_packages_rhel_2(self) -> None:
9385
@mock.patch("ha_cluster_info.HAS_FIREWALL", False)
9486
@mock.patch("ha_cluster_info.HAS_SELINUX", False)
9587
def test_packages_rhel_error_repolist(self) -> None:
96-
rpm_packages = dedent(
97-
"""\
88+
rpm_packages = dedent("""\
9889
package1
9990
resource-agents-cloud
10091
package2
101-
"""
102-
)
92+
""")
10393
with mocked_module(
10494
[
10595
(CMD_DNF_REPORTLIST, (1, "some output", "an error")),
@@ -117,13 +107,11 @@ def test_packages_rhel_error_repolist(self) -> None:
117107
@mock.patch("ha_cluster_info.HAS_FIREWALL", False)
118108
@mock.patch("ha_cluster_info.HAS_SELINUX", False)
119109
def test_packages_rhel_error_pkglist(self) -> None:
120-
dnf_repolist = dedent(
121-
"""\
110+
dnf_repolist = dedent("""\
122111
repo1id Repository 1
123112
highavailability Repository HA Addon
124113
repo2id Repository 2
125-
"""
126-
)
114+
""")
127115
with mocked_module(
128116
[
129117
(CMD_DNF_REPORTLIST, (0, dnf_repolist, "")),

tests/unit/test_info_exporter.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,55 +38,47 @@ def test_two_items(self) -> None:
3838
class ExportEnableReposHa(TestCase):
3939
def test_enabled(self) -> None:
4040
# pylint: disable=line-too-long
41-
dnf_repolist = dedent(
42-
"""\
41+
dnf_repolist = dedent("""\
4342
Updating Subscription Management repositories.
4443
repo id repo name
4544
rhel-10-for-x86_64-appstream-rpms Red Hat Enterprise Linux 10 for x86_64 - AppStream (RPMs)
4645
rhel-10-for-x86_64-baseos-rpms Red Hat Enterprise Linux 10 for x86_64 - BaseOS (RPMs)
4746
rhel-10-for-x86_64-highavailability-rpms Red Hat Enterprise Linux 10 for x86_64 - High Availability (RPMs)
48-
"""
49-
)
47+
""")
5048
self.assertTrue(exporter.export_enable_repos_ha(dnf_repolist))
5149

5250
def test_not_enabled(self) -> None:
53-
dnf_repolist = dedent(
54-
"""\
51+
dnf_repolist = dedent("""\
5552
repo id repo name
5653
fedora Fedora 41 - x86_64
5754
fedora-cisco-openh264 Fedora 41 openh264 (From Cisco) - x86_64
5855
updates Fedora 41 - x86_64 - Updates
59-
"""
60-
)
56+
""")
6157
self.assertFalse(exporter.export_enable_repos_ha(dnf_repolist))
6258

6359

6460
class ExportEnableReposRs(TestCase):
6561
def test_enabled(self) -> None:
6662
# pylint: disable=line-too-long
67-
dnf_repolist = dedent(
68-
"""\
63+
dnf_repolist = dedent("""\
6964
Updating Subscription Management repositories.
7065
repo id repo name
7166
rhel-9-for-x86_64-appstream-rpms Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs)
7267
rhel-9-for-x86_64-baseos-rpms Red Hat Enterprise Linux 9 for x86_64 - BaseOS (RPMs)
7368
rhel-9-for-x86_64-highavailability-rpms Red Hat Enterprise Linux 9 for x86_64 - High Availability (RPMs)
7469
rhel-9-for-x86_64-resilientstorage-rpms Red Hat Enterprise Linux 9 for x86_64 - Resilient Storage (RPMs)
75-
"""
76-
)
70+
""")
7771
self.assertTrue(exporter.export_enable_repos_rs(dnf_repolist))
7872

7973
def test_not_enabled(self) -> None:
8074
# pylint: disable=line-too-long
81-
dnf_repolist = dedent(
82-
"""\
75+
dnf_repolist = dedent("""\
8376
Updating Subscription Management repositories.
8477
repo id repo name
8578
rhel-10-for-x86_64-appstream-rpms Red Hat Enterprise Linux 10 for x86_64 - AppStream (RPMs)
8679
rhel-10-for-x86_64-baseos-rpms Red Hat Enterprise Linux 10 for x86_64 - BaseOS (RPMs)
8780
rhel-10-for-x86_64-highavailability-rpms Red Hat Enterprise Linux 10 for x86_64 - High Availability (RPMs)
88-
"""
89-
)
81+
""")
9082
self.assertFalse(exporter.export_enable_repos_rs(dnf_repolist))
9183

9284

tests/unit/test_info_loader.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,13 @@ def test_unable_to_read_os_release_file(self) -> None:
6666
class GetDnfRepolist(TestCase):
6767
def test_success(self) -> None:
6868
# pylint: disable=line-too-long
69-
dnf_output = dedent(
70-
"""\
69+
dnf_output = dedent("""\
7170
Updating Subscription Management repositories.
7271
repo id repo name
7372
rhel-10-for-x86_64-appstream-rpms Red Hat Enterprise Linux 10 for x86_64 - AppStream (RPMs)
7473
rhel-10-for-x86_64-baseos-rpms Red Hat Enterprise Linux 10 for x86_64 - BaseOS (RPMs)
7574
rhel-10-for-x86_64-highavailability-rpms Red Hat Enterprise Linux 10 for x86_64 - High Availability (RPMs)
76-
"""
77-
)
75+
""")
7876
runner_mock = mock.Mock()
7977
runner_mock.return_value = (0, dnf_output, "")
8078

0 commit comments

Comments
 (0)