diff options
author | Joshua Powers <josh.powers@canonical.com> | 2020-06-01 14:20:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-01 17:20:39 -0400 |
commit | 4ab3303ec4bb49f029b7821d6dba53a6b02b6dc1 (patch) | |
tree | c60b8f1d4ca9735efee890042b9d32ab6bc51f7d /tests/unittests | |
parent | 1211ab449bdfa34b8883c7386772155e6a516ebb (diff) | |
download | vyos-cloud-init-4ab3303ec4bb49f029b7821d6dba53a6b02b6dc1.tar.gz vyos-cloud-init-4ab3303ec4bb49f029b7821d6dba53a6b02b6dc1.zip |
test: fix all flake8 E741 errors (#401)
This removes the use of variables named ‘l’, ‘O’, or ‘I’. Generally
these are used in list comprehension to read the line of lines.
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/test_datasource/test_ec2.py | 4 | ||||
-rw-r--r-- | tests/unittests/test_datasource/test_ovf.py | 2 | ||||
-rw-r--r-- | tests/unittests/test_ds_identify.py | 6 | ||||
-rw-r--r-- | tests/unittests/test_handler/test_handler_apt_source_v3.py | 4 | ||||
-rw-r--r-- | tests/unittests/test_sshutil.py | 2 |
5 files changed, 12 insertions, 6 deletions
diff --git a/tests/unittests/test_datasource/test_ec2.py b/tests/unittests/test_datasource/test_ec2.py index d413d1cd..ad1ea595 100644 --- a/tests/unittests/test_datasource/test_ec2.py +++ b/tests/unittests/test_datasource/test_ec2.py @@ -612,7 +612,9 @@ class TestEc2(test_helpers.HttprettyTestCase): for log in expected_logs: self.assertIn(log, logs) self.assertEqual( - 1, len([l for l in logs.splitlines() if failed_put_log in l])) + 1, + len([line for line in logs.splitlines() if failed_put_log in line]) + ) def test_aws_token_redacted(self): """Verify that aws tokens are redacted when logged.""" diff --git a/tests/unittests/test_datasource/test_ovf.py b/tests/unittests/test_datasource/test_ovf.py index a19c35c8..486a2345 100644 --- a/tests/unittests/test_datasource/test_ovf.py +++ b/tests/unittests/test_datasource/test_ovf.py @@ -48,7 +48,7 @@ def fill_properties(props, template=OVF_ENV_CONTENT): for key, val in props.items(): lines.append(prop_tmpl.format(key=key, val=val)) indent = " " - properties = ''.join([indent + l + "\n" for l in lines]) + properties = ''.join([indent + line + "\n" for line in lines]) return template.format(properties=properties) diff --git a/tests/unittests/test_ds_identify.py b/tests/unittests/test_ds_identify.py index f0e96b44..c2318570 100644 --- a/tests/unittests/test_ds_identify.py +++ b/tests/unittests/test_ds_identify.py @@ -611,8 +611,10 @@ class TestDsIdentify(DsIdentifyBase): ret = self._check_via_dict( cust, RC_FOUND, func=".", args=[os.path.join(rootd, mpp)], rootd=rootd) - line = [l for l in ret.stdout.splitlines() if l.startswith(pre)][0] - toks = line.replace(pre, "").split(":") + match = [ + line for line in ret.stdout.splitlines() if line.startswith(pre) + ][0] + toks = match.replace(pre, "").split(":") expected = ["/sbin", "/bin", "/usr/sbin", "/usr/bin", "/mycust/path"] self.assertEqual(expected, [p for p in expected if p in toks], "path did not have expected tokens") diff --git a/tests/unittests/test_handler/test_handler_apt_source_v3.py b/tests/unittests/test_handler/test_handler_apt_source_v3.py index 4762dbef..aefe26c4 100644 --- a/tests/unittests/test_handler/test_handler_apt_source_v3.py +++ b/tests/unittests/test_handler/test_handler_apt_source_v3.py @@ -1033,7 +1033,9 @@ class TestDebconfSelections(TestCase): # assumes called with *args value. selections = m_set_sel.call_args_list[0][0][0].decode() - missing = [l for l in lines if l not in selections.splitlines()] + missing = [ + line for line in lines if line not in selections.splitlines() + ] self.assertEqual([], missing) @mock.patch("cloudinit.config.cc_apt_configure.dpkg_reconfigure") diff --git a/tests/unittests/test_sshutil.py b/tests/unittests/test_sshutil.py index 0be41924..b4767f0c 100644 --- a/tests/unittests/test_sshutil.py +++ b/tests/unittests/test_sshutil.py @@ -299,7 +299,7 @@ class TestUpdateSshConfigLines(test_helpers.CiTestCase): lines = ssh_util.parse_ssh_config_lines(list(self.exlines)) result = ssh_util.update_ssh_config_lines(lines, updates) self.assertEqual([], result) - self.assertEqual(self.exlines, [str(l) for l in lines]) + self.assertEqual(self.exlines, [str(line) for line in lines]) def test_keycase_not_modified(self): """Original case of key should not be changed on update. |