Commit d1ad27e0 authored by Tom Hughes's avatar Tom Hughes Committed by Copybara-Service
Browse files

Fix formatting in subset of Python files

These files were formatted with automated tools. The remaining Python
files require some manual fix ups, so they will be fixed separately.

PiperOrigin-RevId: 504579820
Change-Id: I3923bd414bffe3ded6163ec496cd09ace3951928
parent 6c65a1ca
......@@ -224,8 +224,7 @@ EXPECTED_JSON = """{
class GTestListTestsOutputUnitTest(gtest_test_utils.TestCase):
"""Unit test for Google Test's list tests with output to file functionality.
"""
"""Unit test for Google Test's list tests with output to file functionality."""
def testXml(self):
"""Verifies XML output for listing tests in a Google Test binary.
......@@ -244,19 +243,22 @@ class GTestListTestsOutputUnitTest(gtest_test_utils.TestCase):
self._TestOutput('json', EXPECTED_JSON)
def _GetOutput(self, out_format):
file_path = os.path.join(gtest_test_utils.GetTempDir(),
'test_out.' + out_format)
file_path = os.path.join(
gtest_test_utils.GetTempDir(), 'test_out.' + out_format
)
gtest_prog_path = gtest_test_utils.GetTestExecutablePath(
'gtest_list_output_unittest_')
'gtest_list_output_unittest_'
)
command = ([
command = [
gtest_prog_path,
'%s=%s:%s' % (GTEST_OUTPUT_FLAG, out_format, file_path),
'--gtest_list_tests'
])
'--gtest_list_tests',
]
environ_copy = os.environ.copy()
p = gtest_test_utils.Subprocess(
command, env=environ_copy, working_dir=gtest_test_utils.GetTempDir())
command, env=environ_copy, working_dir=gtest_test_utils.GetTempDir()
)
self.assertTrue(p.exited)
self.assertEqual(0, p.exit_code)
......@@ -275,9 +277,10 @@ class GTestListTestsOutputUnitTest(gtest_test_utils.TestCase):
expected_line_re = re.compile(expected_line.strip())
self.assertTrue(
expected_line_re.match(actual_line.strip()),
('actual output of "%s",\n'
'which does not match expected regex of "%s"\n'
'on line %d' % (actual, expected_output, line_count)))
'actual output of "%s",\n'
'which does not match expected regex of "%s"\n'
'on line %d' % (actual, expected_output, line_count),
)
line_count = line_count + 1
......
......@@ -51,7 +51,8 @@ class SkipEntireEnvironmentTest(gtest_test_utils.TestCase):
skip_fixture = 'Skipped\nskipping all tests for this fixture\n'
self.assertIsNotNone(
re.search(skip_fixture + '.*' + skip_fixture, OUTPUT, flags=re.DOTALL),
repr(OUTPUT))
repr(OUTPUT),
)
self.assertNotIn('FAILED', OUTPUT)
......
......@@ -37,7 +37,8 @@ from googletest.test import gtest_test_utils
# Path to the gtest_skip_in_environment_setup_test binary
EXE_PATH = gtest_test_utils.GetTestExecutablePath(
'gtest_skip_in_environment_setup_test')
'gtest_skip_in_environment_setup_test'
)
OUTPUT = gtest_test_utils.Subprocess([EXE_PATH]).output
......
......@@ -76,8 +76,9 @@ class GTestXMLOutFilesTest(gtest_xml_test_utils.GTestXMLTestCase):
# We want the trailing '/' that the last "" provides in os.path.join, for
# telling Google Test to create an output directory instead of a single file
# for xml output.
self.output_dir_ = os.path.join(gtest_test_utils.GetTempDir(),
GTEST_OUTPUT_SUBDIR, "")
self.output_dir_ = os.path.join(
gtest_test_utils.GetTempDir(), GTEST_OUTPUT_SUBDIR, ""
)
self.DeleteFilesAndDir()
def tearDown(self):
......@@ -106,14 +107,15 @@ class GTestXMLOutFilesTest(gtest_xml_test_utils.GTestXMLTestCase):
def _TestOutFile(self, test_name, expected_xml):
gtest_prog_path = gtest_test_utils.GetTestExecutablePath(test_name)
command = [gtest_prog_path, "--gtest_output=xml:%s" % self.output_dir_]
p = gtest_test_utils.Subprocess(command,
working_dir=gtest_test_utils.GetTempDir())
p = gtest_test_utils.Subprocess(
command, working_dir=gtest_test_utils.GetTempDir()
)
self.assertTrue(p.exited)
self.assertEqual(0, p.exit_code)
output_file_name1 = test_name + ".xml"
output_file1 = os.path.join(self.output_dir_, output_file_name1)
output_file_name2 = 'lt-' + output_file_name1
output_file_name2 = "lt-" + output_file_name1
output_file2 = os.path.join(self.output_dir_, output_file_name2)
self.assertTrue(
os.path.isfile(output_file1) or os.path.isfile(output_file2),
......@@ -126,8 +128,7 @@ class GTestXMLOutFilesTest(gtest_xml_test_utils.GTestXMLTestCase):
else:
actual = minidom.parse(output_file2)
self.NormalizeXml(actual.documentElement)
self.AssertEquivalentNodes(expected.documentElement,
actual.documentElement)
self.AssertEquivalentNodes(expected.documentElement, actual.documentElement)
expected.unlink()
actual.unlink()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment