mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #24186 from dkurt:ts_fixture_constructor_skip
Skip test on SkipTestException at fixture's constructor * Skip test on SkipTestException at fixture's constructor * Add warning supression * Skip Python tests if no test file found * Skip instances of test fixture with exception at SetUpTestCase * Skip test with exception at SetUp method * Try remove warning disable * Add CV_NORETURN * Remove FAIL assertion * Use findDataFile to throw Skip exception * Throw exception conditionally
This commit is contained in:
@@ -917,5 +917,41 @@ REGISTER_TYPED_TEST_CASE_P(Rect_Test, Overflows);
|
||||
typedef ::testing::Types<int, float, double> RectTypes;
|
||||
INSTANTIATE_TYPED_TEST_CASE_P(Negative_Test, Rect_Test, RectTypes);
|
||||
|
||||
// Expected that SkipTestException thrown in the constructor should skip test but not fail
|
||||
struct TestFixtureSkip: public ::testing::Test {
|
||||
TestFixtureSkip(bool throwEx = true) {
|
||||
if (throwEx) {
|
||||
throw SkipTestException("Skip test at constructor");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(TestFixtureSkip, NoBodyRun) {
|
||||
FAIL() << "Unreachable code called";
|
||||
}
|
||||
|
||||
// Check no test body started in case of skip exception at static SetUpTestCase
|
||||
struct TestSetUpTestCaseSkip: public ::testing::Test {
|
||||
static void SetUpTestCase() {
|
||||
throw SkipTestException("Skip test at SetUpTestCase");
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(TestSetUpTestCaseSkip, NoBodyRun) {
|
||||
FAIL() << "Unreachable code called";
|
||||
}
|
||||
TEST_F(TestSetUpTestCaseSkip, NoBodyRun2) {
|
||||
FAIL() << "Unreachable code called";
|
||||
}
|
||||
|
||||
struct TestSetUpSkip: public ::testing::Test {
|
||||
virtual void SetUp() {
|
||||
throw SkipTestException("Skip test at SetUp");
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(TestSetUpSkip, NoBodyRun) {
|
||||
FAIL() << "Unreachable code called";
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
|
||||
Reference in New Issue
Block a user