mirror of
https://github.com/google/googletest.git
synced 2025-12-07 01:06:50 +08:00
Do not print skipped test's messages in brief mode
This commit is contained in:
parent
3983f67e32
commit
8d24b1552b
@ -2463,7 +2463,7 @@ void TestResult::Clear() {
|
|||||||
elapsed_time_ = 0;
|
elapsed_time_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true off the test part was skipped.
|
// Returns true if the test part was skipped.
|
||||||
static bool TestPartSkipped(const TestPartResult& result) {
|
static bool TestPartSkipped(const TestPartResult& result) {
|
||||||
return result.skipped();
|
return result.skipped();
|
||||||
}
|
}
|
||||||
@ -3755,6 +3755,8 @@ void BriefUnitTestResultPrinter::OnTestPartResult(
|
|||||||
// If the test part succeeded, we don't need to do anything.
|
// If the test part succeeded, we don't need to do anything.
|
||||||
case TestPartResult::kSuccess:
|
case TestPartResult::kSuccess:
|
||||||
return;
|
return;
|
||||||
|
case TestPartResult::kSkip:
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
// Print failure message from the assertion
|
// Print failure message from the assertion
|
||||||
// (e.g. expected this and got that).
|
// (e.g. expected this and got that).
|
||||||
|
|||||||
@ -37,7 +37,7 @@ import re
|
|||||||
|
|
||||||
from googletest.test import gtest_test_utils
|
from googletest.test import gtest_test_utils
|
||||||
|
|
||||||
# Path to the gtest_skip_in_environment_setup_test binary
|
# Path to the gtest_skip_test binary
|
||||||
EXE_PATH = gtest_test_utils.GetTestExecutablePath('gtest_skip_test')
|
EXE_PATH = gtest_test_utils.GetTestExecutablePath('gtest_skip_test')
|
||||||
|
|
||||||
OUTPUT = gtest_test_utils.Subprocess([EXE_PATH]).output
|
OUTPUT = gtest_test_utils.Subprocess([EXE_PATH]).output
|
||||||
@ -55,6 +55,17 @@ class SkipEntireEnvironmentTest(gtest_test_utils.TestCase):
|
|||||||
)
|
)
|
||||||
self.assertNotIn('FAILED', OUTPUT)
|
self.assertNotIn('FAILED', OUTPUT)
|
||||||
|
|
||||||
|
def testSkipTestWithBriefFlag(self):
|
||||||
|
brief_output = gtest_test_utils.Subprocess([EXE_PATH, "--gtest_brief=1"]).output
|
||||||
|
self.assertNotIn('Skipped\nskipping single test\n', brief_output)
|
||||||
|
skip_fixture = 'Skipped\nskipping all tests for this fixture\n'
|
||||||
|
self.assertIsNone(
|
||||||
|
re.search(skip_fixture + '.*' + skip_fixture, brief_output, flags=re.DOTALL),
|
||||||
|
repr(brief_output),
|
||||||
|
)
|
||||||
|
self.assertIn('SKIPPED', brief_output)
|
||||||
|
self.assertNotIn('FAILED', brief_output)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
gtest_test_utils.Main()
|
gtest_test_utils.Main()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user