Remove invalid-string-quote from //testing
Removes the invalid-string-quote disable from the //testing pylintrc
file and fixes all resulting errors.
Bug: 353942917
Change-Id: I4e8ef60d4f7b7645fee7ee86d579032bb0c24eb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5784807
Commit-Queue: Ben Pastene <[email protected]>
Auto-Submit: Brian Sheedy <[email protected]>
Reviewed-by: Ben Pastene <[email protected]>
Commit-Queue: Brian Sheedy <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1341341}
NOKEYCHECK=True
GitOrigin-RevId: 0d2300f3e5f6fa73e4fb6590633f4f331ffc8fc7
diff --git a/exe_util_unittests.py b/exe_util_unittests.py
index 9b16978..6ceeef5 100755
--- a/exe_util_unittests.py
+++ b/exe_util_unittests.py
@@ -14,6 +14,6 @@
class ExeUtilTests(fake_filesystem_unittest.TestCase):
def test_run_and_tee_output(self):
# Test wrapping Python as it echos a '.' character back.
- args = [sys.executable, '-c', 'print(\'.\')']
+ args = [sys.executable, '-c', "print('.')"]
output = exe_util.run_and_tee_output(args)
self.assertEqual('.', output.strip())
diff --git a/generate_script.py b/generate_script.py
index ec5fa95..f053133 100755
--- a/generate_script.py
+++ b/generate_script.py
@@ -55,9 +55,9 @@
raise ValueError(
f'Duplicate entry "{exe_name}" in {input_filepath}')
if args.make_bat:
- suffix = ".exe"
+ suffix = '.exe'
else:
- suffix = ""
+ suffix = ''
exes.add(f'{exe_name}{suffix}')
if not exes:
raise ValueError(f'Unexpectedly empty file: {input_filepath}')
diff --git a/generate_script_unittests.py b/generate_script_unittests.py
index c627731..b6e2cb5 100755
--- a/generate_script_unittests.py
+++ b/generate_script_unittests.py
@@ -38,8 +38,8 @@
mode='w',
encoding='utf-8') as f:
filepath = f.name
- f.write("foo\n")
- f.write("bar\n")
+ f.write('foo\n')
+ f.write('bar\n')
try:
args.rust_test_executables = filepath
actual = _generate_script(args,
@@ -49,7 +49,8 @@
expected = '''
#!/bin/bash
-env vpython3 "$(dirname $0)/../../../testing/scripts/rust/rust_main_program.py" \\
+env vpython3 \
+"$(dirname $0)/../../../testing/scripts/rust/rust_main_program.py" \\
"--rust-test-executable=$(dirname $0)/../bar" \\
"--rust-test-executable=$(dirname $0)/../foo" \\
"$@"
@@ -70,8 +71,8 @@
mode='w',
encoding='utf-8') as f:
filepath = f.name
- f.write("foo\n")
- f.write("bar\n")
+ f.write('foo\n')
+ f.write('bar\n')
try:
args.rust_test_executables = filepath
actual = _generate_script(args,
diff --git a/rust_main_program.py b/rust_main_program.py
index 69b8c87..8e51788 100644
--- a/rust_main_program.py
+++ b/rust_main_program.py
@@ -17,17 +17,17 @@
def _format_test_name(test_executable_name, test_case_name):
- assert "//" not in test_executable_name
- assert "/" not in test_case_name
- test_case_name = "/".join(test_case_name.split("::"))
- return "{}//{}".format(test_executable_name, test_case_name)
+ assert '//' not in test_executable_name
+ assert '/' not in test_case_name
+ test_case_name = '/'.join(test_case_name.split('::'))
+ return '{}//{}'.format(test_executable_name, test_case_name)
def _parse_test_name(test_name):
- assert "//" in test_name
- assert "::" not in test_name
- test_executable_name, test_case_name = test_name.split("//", 1)
- test_case_name = "::".join(test_case_name.split("/"))
+ assert '//' in test_name
+ assert '::' not in test_name
+ test_executable_name, test_case_name = test_name.split('//', 1)
+ test_case_name = '::'.join(test_case_name.split('/'))
return test_executable_name, test_case_name
@@ -53,7 +53,7 @@
continue
else:
raise ValueError(
- "Unexpected format of a list of tests: {}".format(output))
+ 'Unexpected format of a list of tests: {}'.format(output))
test_names = [
_format_test_name(test_executable_name, test_case_name)
for test_case_name in test_case_names
@@ -153,9 +153,9 @@
]
args.extend(list_of_tests_to_run)
- print("Running tests from {}...".format(self._name_of_test_executable))
+ print('Running tests from {}...'.format(self._name_of_test_executable))
output = exe_util.run_and_tee_output(args)
- print("Running tests from {}... DONE.".format(
+ print('Running tests from {}... DONE.'.format(
self._name_of_test_executable))
print()
diff --git a/rust_main_program_unittests.py b/rust_main_program_unittests.py
index d529cd4..6db43a0 100755
--- a/rust_main_program_unittests.py
+++ b/rust_main_program_unittests.py
@@ -57,7 +57,8 @@
running 1 test
test test_hello ... ok
-test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; \
+finished in 0.00s
""".strip()
with self.assertRaises(ValueError):
_scrape_test_list(test_input, 'test_exe_name')
@@ -82,7 +83,8 @@
failures:
test_foobar
-test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
+test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured; \
+0 filtered out; finished in 0.00s
""".strip()
list_of_expected_test_names = [
'test_foo', 'test_bar', 'foo::test_in_mod', 'test_foobar'
@@ -107,8 +109,8 @@
def test_get_exe_specific_tests(self):
result = _get_exe_specific_tests(
- "exe_name",
- ["exe_name//foo1", "exe_name//foo2", "other_exe//foo3"])
+ 'exe_name',
+ ['exe_name//foo1', 'exe_name//foo2', 'other_exe//foo3'])
self.assertEqual(['foo1', 'foo2'], result)
def test_executable_wrapper_basic_construction(self):
diff --git a/test_filtering.py b/test_filtering.py
index b054e77..34bf7f3 100644
--- a/test_filtering.py
+++ b/test_filtering.py
@@ -73,9 +73,9 @@
def __str__(self):
result = self._filter_text
if self._is_exclusion_filter:
- result = "-" + result
+ result = '-' + result
if self._is_prefix_match:
- result += "*"
+ result += '*'
return result