Skip to content

Commit 153654d

Browse files
author
Kevin Lampis
committed
Fix pylint errors
Variable name "COUNTER" doesn't conform to '[a-z_][a-zA-Z0-9_]{0,30}$' pattern Method name "test_set_grub_variable_throws_without_envfile" doesn't conform to '[a-z_][a-zA-Z0-9_]{2,34}$' pattern Method name "test_contents_not_clobbered_by_setnextboot" doesn't conform to '[a-z_][a-zA-Z0-9_]{2,34}$' pattern Signed-off-by: Kevin Lampis <[email protected]>
1 parent bb777a0 commit 153654d

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

tests/test_bootloader.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ def test_set_grub_variable(self):
6464
self.assertTrue(os.path.isfile(env))
6565
self.assertGreater(os.path.getsize(env), 0)
6666

67-
def test_set_grub_variable_throws_without_envfile(self):
67+
def test_set_variable_no_envfile(self):
68+
"""
69+
Test that calling setGrubVariable() without setting an envfile first
70+
will throw an exception.
71+
"""
6872
bl = Bootloader("", "", env_block=None)
6973

7074
with self.assertRaises(AssertionError):
@@ -184,7 +188,10 @@ def test_arbitrary_contents(self):
184188
}
185189
''')
186190

187-
def test_contents_not_clobbered_by_setnextboot(self):
191+
def test_contents_not_clobbered(self):
192+
"""
193+
Test that MenuEntry.contents is not clobbered by setNextBoot
194+
"""
188195

189196
self.assertIsNone(self.bl.env_block)
190197
self.bl.env_block = self.env

xcp/bootloader.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
from .compat import open_textfile
4242

43-
COUNTER = 0
43+
_counter = 0
4444

4545
class Grub2Format(Enum):
4646
MULTIBOOT2 = 0
@@ -127,7 +127,7 @@ def readGrub2(cls, src_file):
127127
entry_format = Grub2Format.MULTIBOOT2
128128

129129
def create_label(title):
130-
global COUNTER
130+
global _counter
131131

132132
if title == branding.PRODUCT_BRAND:
133133
return 'xe'
@@ -142,8 +142,8 @@ def create_label(title):
142142
return 'fallback-serial'
143143
else:
144144
return 'fallback'
145-
COUNTER += 1
146-
return "label%d" % COUNTER
145+
_counter += 1
146+
return "label%d" % _counter
147147

148148
def parse_boot_entry(line):
149149
parts = line.split(None, 2) # Split into at most 3 parts

0 commit comments

Comments
 (0)