proxygen
gtest_output_test.GTestOutputTest Class Reference
Inheritance diagram for gtest_output_test.GTestOutputTest:

Public Member Functions

def RemoveUnsupportedTests (self, test_output)
 
def testOutput (self)
 
def RemoveUnsupportedTests (self, test_output)
 
def testOutput (self)
 
def RemoveUnsupportedTests (self, test_output)
 
def testOutput (self)
 

Detailed Description

Definition at line 259 of file gtest_output_test.py.

Member Function Documentation

def gtest_output_test.GTestOutputTest.RemoveUnsupportedTests (   self,
  test_output 
)

Definition at line 260 of file gtest_output_test.py.

References gtest_output_test.RemoveMatchingTests(), and gtest_output_test.RemoveStackTraces().

Referenced by gtest_output_test.GTestOutputTest.RemoveUnsupportedTests(), and gtest_output_test.GTestOutputTest.testOutput().

260  def RemoveUnsupportedTests(self, test_output):
261  if not SUPPORTS_DEATH_TESTS:
262  test_output = RemoveMatchingTests(test_output, 'DeathTest')
263  if not SUPPORTS_TYPED_TESTS:
264  test_output = RemoveMatchingTests(test_output, 'TypedTest')
265  test_output = RemoveMatchingTests(test_output, 'TypedDeathTest')
266  test_output = RemoveMatchingTests(test_output, 'TypeParamDeathTest')
267  if not SUPPORTS_THREADS:
268  test_output = RemoveMatchingTests(test_output,
269  'ExpectFailureWithThreadsTest')
270  test_output = RemoveMatchingTests(test_output,
271  'ScopedFakeTestPartResultReporterTest')
272  test_output = RemoveMatchingTests(test_output,
273  'WorksConcurrently')
274  if not SUPPORTS_STACK_TRACES:
275  test_output = RemoveStackTraces(test_output)
276 
277  return test_output
278 
def RemoveMatchingTests(test_output, pattern)
def RemoveStackTraces(output)
def RemoveUnsupportedTests(self, test_output)
def gtest_output_test.GTestOutputTest.RemoveUnsupportedTests (   self,
  test_output 
)

Definition at line 260 of file gtest_output_test.py.

References gtest_output_test.RemoveMatchingTests(), gtest_output_test.RemoveStackTraces(), and gtest_output_test.GTestOutputTest.RemoveUnsupportedTests().

260  def RemoveUnsupportedTests(self, test_output):
261  if not SUPPORTS_DEATH_TESTS:
262  test_output = RemoveMatchingTests(test_output, 'DeathTest')
263  if not SUPPORTS_TYPED_TESTS:
264  test_output = RemoveMatchingTests(test_output, 'TypedTest')
265  test_output = RemoveMatchingTests(test_output, 'TypedDeathTest')
266  test_output = RemoveMatchingTests(test_output, 'TypeParamDeathTest')
267  if not SUPPORTS_THREADS:
268  test_output = RemoveMatchingTests(test_output,
269  'ExpectFailureWithThreadsTest')
270  test_output = RemoveMatchingTests(test_output,
271  'ScopedFakeTestPartResultReporterTest')
272  test_output = RemoveMatchingTests(test_output,
273  'WorksConcurrently')
274  if not SUPPORTS_STACK_TRACES:
275  test_output = RemoveStackTraces(test_output)
276 
277  return test_output
278 
def RemoveMatchingTests(test_output, pattern)
def RemoveStackTraces(output)
def RemoveUnsupportedTests(self, test_output)
def gtest_output_test.GTestOutputTest.RemoveUnsupportedTests (   self,
  test_output 
)

Definition at line 260 of file gtest_output_test.py.

References gtest_output_test.RemoveMatchingTests(), gtest_output_test.RemoveStackTraces(), and gtest_output_test.GTestOutputTest.RemoveUnsupportedTests().

260  def RemoveUnsupportedTests(self, test_output):
261  if not SUPPORTS_DEATH_TESTS:
262  test_output = RemoveMatchingTests(test_output, 'DeathTest')
263  if not SUPPORTS_TYPED_TESTS:
264  test_output = RemoveMatchingTests(test_output, 'TypedTest')
265  test_output = RemoveMatchingTests(test_output, 'TypedDeathTest')
266  test_output = RemoveMatchingTests(test_output, 'TypeParamDeathTest')
267  if not SUPPORTS_THREADS:
268  test_output = RemoveMatchingTests(test_output,
269  'ExpectFailureWithThreadsTest')
270  test_output = RemoveMatchingTests(test_output,
271  'ScopedFakeTestPartResultReporterTest')
272  test_output = RemoveMatchingTests(test_output,
273  'WorksConcurrently')
274  if not SUPPORTS_STACK_TRACES:
275  test_output = RemoveStackTraces(test_output)
276 
277  return test_output
278 
def RemoveMatchingTests(test_output, pattern)
def RemoveStackTraces(output)
def RemoveUnsupportedTests(self, test_output)
def gtest_output_test.GTestOutputTest.testOutput (   self)

Definition at line 279 of file gtest_output_test.py.

References gtest_output_test.GetOutputOfAllCommands(), gtest_test_utils.GetSourceDir(), join, gtest_test_utils.Main(), gtest_output_test.NormalizeToCurrentPlatform(), gtest_output_test.RemoveTestCounts(), gtest_output_test.RemoveTypeInfoDetails(), gtest_output_test.GTestOutputTest.RemoveUnsupportedTests(), gtest_output_test.GTestOutputTest.testOutput(), gtest_output_test.ToUnixLineEnding(), and fizz::detail.write().

279  def testOutput(self):
280  output = GetOutputOfAllCommands()
281 
282  golden_file = open(GOLDEN_PATH, 'r')
283  # A mis-configured source control system can cause \r appear in EOL
284  # sequences when we read the golden file irrespective of an operating
285  # system used. Therefore, we need to strip those \r's from newlines
286  # unconditionally.
287  golden = ToUnixLineEnding(golden_file.read())
288  golden_file.close()
289 
290  # We want the test to pass regardless of certain features being
291  # supported or not.
292 
293  # We still have to remove type name specifics in all cases.
294  normalized_actual = RemoveTypeInfoDetails(output)
295  normalized_golden = RemoveTypeInfoDetails(golden)
296 
297  if CAN_GENERATE_GOLDEN_FILE:
298  self.assertEqual(normalized_golden, normalized_actual,
299  '\n'.join(difflib.unified_diff(
300  normalized_golden.split('\n'),
301  normalized_actual.split('\n'),
302  'golden', 'actual')))
303  else:
304  normalized_actual = NormalizeToCurrentPlatform(
305  RemoveTestCounts(normalized_actual))
306  normalized_golden = NormalizeToCurrentPlatform(
307  RemoveTestCounts(self.RemoveUnsupportedTests(normalized_golden)))
308 
309  # This code is very handy when debugging golden file differences:
310  if os.getenv('DEBUG_GTEST_OUTPUT_TEST'):
311  open(os.path.join(
313  '_gtest_output_test_normalized_actual.txt'), 'wb').write(
314  normalized_actual)
315  open(os.path.join(
317  '_gtest_output_test_normalized_golden.txt'), 'wb').write(
318  normalized_golden)
319 
320  self.assertEqual(normalized_golden, normalized_actual)
321 
322 
void write(const T &in, folly::io::Appender &appender)
Definition: Types-inl.h:112
def NormalizeToCurrentPlatform(test_output)
def RemoveTypeInfoDetails(test_output)
def RemoveTestCounts(output)
#define join
def RemoveUnsupportedTests(self, test_output)
def gtest_output_test.GTestOutputTest.testOutput (   self)

Definition at line 279 of file gtest_output_test.py.

References gtest_output_test.GetOutputOfAllCommands(), gtest_test_utils.GetSourceDir(), join, gtest_output_test.NormalizeToCurrentPlatform(), gtest_output_test.RemoveTestCounts(), gtest_output_test.RemoveTypeInfoDetails(), gtest_output_test.GTestOutputTest.RemoveUnsupportedTests(), gtest_output_test.ToUnixLineEnding(), and fizz::detail.write().

Referenced by gtest_output_test.GTestOutputTest.testOutput().

279  def testOutput(self):
280  output = GetOutputOfAllCommands()
281 
282  golden_file = open(GOLDEN_PATH, 'r')
283  # A mis-configured source control system can cause \r appear in EOL
284  # sequences when we read the golden file irrespective of an operating
285  # system used. Therefore, we need to strip those \r's from newlines
286  # unconditionally.
287  golden = ToUnixLineEnding(golden_file.read())
288  golden_file.close()
289 
290  # We want the test to pass regardless of certain features being
291  # supported or not.
292 
293  # We still have to remove type name specifics in all cases.
294  normalized_actual = RemoveTypeInfoDetails(output)
295  normalized_golden = RemoveTypeInfoDetails(golden)
296 
297  if CAN_GENERATE_GOLDEN_FILE:
298  self.assertEqual(normalized_golden, normalized_actual,
299  '\n'.join(difflib.unified_diff(
300  normalized_golden.split('\n'),
301  normalized_actual.split('\n'),
302  'golden', 'actual')))
303  else:
304  normalized_actual = NormalizeToCurrentPlatform(
305  RemoveTestCounts(normalized_actual))
306  normalized_golden = NormalizeToCurrentPlatform(
307  RemoveTestCounts(self.RemoveUnsupportedTests(normalized_golden)))
308 
309  # This code is very handy when debugging golden file differences:
310  if os.getenv('DEBUG_GTEST_OUTPUT_TEST'):
311  open(os.path.join(
313  '_gtest_output_test_normalized_actual.txt'), 'wb').write(
314  normalized_actual)
315  open(os.path.join(
317  '_gtest_output_test_normalized_golden.txt'), 'wb').write(
318  normalized_golden)
319 
320  self.assertEqual(normalized_golden, normalized_actual)
321 
322 
void write(const T &in, folly::io::Appender &appender)
Definition: Types-inl.h:112
def NormalizeToCurrentPlatform(test_output)
def RemoveTypeInfoDetails(test_output)
def RemoveTestCounts(output)
#define join
def RemoveUnsupportedTests(self, test_output)
def gtest_output_test.GTestOutputTest.testOutput (   self)

Definition at line 279 of file gtest_output_test.py.

References gtest_output_test.GetOutputOfAllCommands(), gtest_test_utils.GetSourceDir(), join, gtest_test_utils.Main(), gtest_output_test.NormalizeToCurrentPlatform(), gtest_output_test.RemoveTestCounts(), gtest_output_test.RemoveTypeInfoDetails(), gtest_output_test.GTestOutputTest.RemoveUnsupportedTests(), gtest_output_test.GTestOutputTest.testOutput(), gtest_output_test.ToUnixLineEnding(), and fizz::detail.write().

279  def testOutput(self):
280  output = GetOutputOfAllCommands()
281 
282  golden_file = open(GOLDEN_PATH, 'r')
283  # A mis-configured source control system can cause \r appear in EOL
284  # sequences when we read the golden file irrespective of an operating
285  # system used. Therefore, we need to strip those \r's from newlines
286  # unconditionally.
287  golden = ToUnixLineEnding(golden_file.read())
288  golden_file.close()
289 
290  # We want the test to pass regardless of certain features being
291  # supported or not.
292 
293  # We still have to remove type name specifics in all cases.
294  normalized_actual = RemoveTypeInfoDetails(output)
295  normalized_golden = RemoveTypeInfoDetails(golden)
296 
297  if CAN_GENERATE_GOLDEN_FILE:
298  self.assertEqual(normalized_golden, normalized_actual,
299  '\n'.join(difflib.unified_diff(
300  normalized_golden.split('\n'),
301  normalized_actual.split('\n'),
302  'golden', 'actual')))
303  else:
304  normalized_actual = NormalizeToCurrentPlatform(
305  RemoveTestCounts(normalized_actual))
306  normalized_golden = NormalizeToCurrentPlatform(
307  RemoveTestCounts(self.RemoveUnsupportedTests(normalized_golden)))
308 
309  # This code is very handy when debugging golden file differences:
310  if os.getenv('DEBUG_GTEST_OUTPUT_TEST'):
311  open(os.path.join(
313  '_gtest_output_test_normalized_actual.txt'), 'wb').write(
314  normalized_actual)
315  open(os.path.join(
317  '_gtest_output_test_normalized_golden.txt'), 'wb').write(
318  normalized_golden)
319 
320  self.assertEqual(normalized_golden, normalized_actual)
321 
322 
void write(const T &in, folly::io::Appender &appender)
Definition: Types-inl.h:112
def NormalizeToCurrentPlatform(test_output)
def RemoveTypeInfoDetails(test_output)
def RemoveTestCounts(output)
#define join
def RemoveUnsupportedTests(self, test_output)

The documentation for this class was generated from the following file: