Beispiel #1
0
 def testCatchesLeakedMockByDefault(self):
   self.assertNotEqual(
       0,
       gmock_test_utils.Subprocess(TEST_WITH_EXPECT_CALL,
                                   env=environ).exit_code)
   self.assertNotEqual(
       0,
       gmock_test_utils.Subprocess(TEST_WITH_ON_CALL,
                                   env=environ).exit_code)
Beispiel #2
0
 def testCatchesLeakedMockWhenEnabled(self):
   self.assertNotEqual(
       0,
       gmock_test_utils.Subprocess(TEST_WITH_EXPECT_CALL +
                                   ['--gmock_catch_leaked_mocks'],
                                   env=environ).exit_code)
   self.assertNotEqual(
       0,
       gmock_test_utils.Subprocess(TEST_WITH_ON_CALL +
                                   ['--gmock_catch_leaked_mocks'],
                                   env=environ).exit_code)
Beispiel #3
0
 def testDoesNotCatchLeakedMockWhenDisabled(self):
   self.assertEquals(
       0,
       gmock_test_utils.Subprocess(TEST_WITH_EXPECT_CALL +
                                   ['--gmock_catch_leaked_mocks=0'],
                                   env=environ).exit_code)
   self.assertEquals(
       0,
       gmock_test_utils.Subprocess(TEST_WITH_ON_CALL +
                                   ['--gmock_catch_leaked_mocks=0'],
                                   env=environ).exit_code)
Beispiel #4
0
 def testCatchesMultipleLeakedMocks(self):
   self.assertNotEqual(
       0,
       gmock_test_utils.Subprocess(TEST_MULTIPLE_LEAKS +
                                   ['--gmock_catch_leaked_mocks'],
                                   env=environ).exit_code)
Beispiel #5
0
def GetShellCommandOutput(cmd):
  """Runs a command in a sub-process, and returns its STDOUT in a string."""

  return gmock_test_utils.Subprocess(cmd, capture_stderr=False).output