More fixes against pylint warnings that autopep8 didn't handle
in the previous commit.
Signed-off-by: AKASHI Takahiro
---
test/py/tests/test_efi_secboot/conftest.py| 11 +--
.../py/tests/test_efi_secboot/test_authvar.py | 91 +--
test/py/tests/test_efi_secboot/test_signed.py | 73 ---
.../tests/test_efi_secboot/test_unsigned.py | 29 +++---
4 files changed, 100 insertions(+), 104 deletions(-)
diff --git a/test/py/tests/test_efi_secboot/conftest.py
b/test/py/tests/test_efi_secboot/conftest.py
index f74b4b109a7b..34abcd79ae00 100644
--- a/test/py/tests/test_efi_secboot/conftest.py
+++ b/test/py/tests/test_efi_secboot/conftest.py
@@ -4,9 +4,8 @@
import os
import os.path
-import pytest
-import re
from subprocess import call, check_call, check_output, CalledProcessError
+import pytest
from defs import *
# from test/py/conftest.py
@@ -14,8 +13,8 @@ from defs import *
def tool_is_in_path(tool):
for path in os.environ["PATH"].split(os.pathsep):
-fn = os.path.join(path, tool)
-if os.path.isfile(fn) and os.access(fn, os.X_OK):
+full_path = os.path.join(path, tool)
+if os.path.isfile(full_path) and os.access(full_path, os.X_OK):
return True
return False
@@ -164,8 +163,8 @@ def efi_boot_env(request, u_boot_config):
check_call('sudo umount %s' % loop_dev, shell=True)
check_call('sudo losetup -d %s' % loop_dev, shell=True)
-except CalledProcessError as e:
-pytest.skip('Setup failed: %s' % e.cmd)
+except CalledProcessError as exception:
+pytest.skip('Setup failed: %s' % exception.cmd)
return
else:
yield image_path
diff --git a/test/py/tests/test_efi_secboot/test_authvar.py
b/test/py/tests/test_efi_secboot/test_authvar.py
index 359adba4b4b7..d0c6b9035b1b 100644
--- a/test/py/tests/test_efi_secboot/test_authvar.py
+++ b/test/py/tests/test_efi_secboot/test_authvar.py
@@ -9,7 +9,6 @@ This test verifies variable authentication
"""
import pytest
-from defs import *
@pytest.mark.boardspec('sandbox')
@@ -29,18 +28,18 @@ class TestEfiAuthVar(object):
output = u_boot_console.run_command_list([
'host bind 0 %s' % disk_img,
'printenv -e SecureBoot'])
-assert(': 00' in ''.join(output))
+assert ': 00' in ''.join(output)
output = u_boot_console.run_command(
'printenv -e SetupMode')
-assert(': 01' in output)
+assert ': 01' in output
with u_boot_console.log.section('Test Case 1b'):
# Test Case 1b, PK without AUTHENTICATED_WRITE_ACCESS
output = u_boot_console.run_command_list([
'fatload host 0:1 400 PK.auth',
'setenv -e -nv -bs -rt -i 400,$filesize PK'])
-assert('Failed to set EFI variable' in ''.join(output))
+assert 'Failed to set EFI variable' in ''.join(output)
with u_boot_console.log.section('Test Case 1c'):
# Test Case 1c, install PK
@@ -48,79 +47,79 @@ class TestEfiAuthVar(object):
'fatload host 0:1 400 PK.auth',
'setenv -e -nv -bs -rt -at -i 400,$filesize PK',
'printenv -e -n PK'])
-assert('PK:' in ''.join(output))
+assert 'PK:' in ''.join(output)
output = u_boot_console.run_command(
'printenv -e SecureBoot')
-assert(': 01' in output)
+assert ': 01' in output
output = u_boot_console.run_command(
'printenv -e SetupMode')
-assert(': 00' in output)
+assert ': 00' in output
with u_boot_console.log.section('Test Case 1d'):
# Test Case 1d, db/dbx without KEK
output = u_boot_console.run_command_list([
'fatload host 0:1 400 db.auth',
'setenv -e -nv -bs -rt -at -i 400,$filesize db'])
-assert('Failed to set EFI variable' in ''.join(output))
+assert 'Failed to set EFI variable' in ''.join(output)
output = u_boot_console.run_command_list([
'fatload host 0:1 400 db.auth',
'setenv -e -nv -bs -rt -at -i 400,$filesize dbx'])
-assert('Failed to set EFI variable' in ''.join(output))
+assert 'Failed to set EFI variable' in ''.join(output)
with u_boot_console.log.section('Test Case 1e'):
# Test Case 1e, install KEK
output = u_boot_console.run_command_list([
'fatload host 0:1 400 KEK.auth',
'setenv -e -nv -bs -rt -i 400,$filesize KEK'])
-assert('Failed to set EFI variable' in ''.join(output))
+assert 'Failed to set EFI variable' in ''.join(output)
output =