1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53: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:
Dmitry Kurtaev
2023-08-25 14:53:34 +03:00
committed by GitHub
parent 81cc89a3ce
commit 588ddf1b18
4 changed files with 85 additions and 8 deletions
+9 -4
View File
@@ -11,7 +11,7 @@ namespace cvtest {
static bool printTestTag = false;
static std::vector<std::string> currentDirectTestTags, currentImpliedTestTags;
static std::vector<const ::testing::TestInfo*> skipped_tests;
static std::vector<const ::testing::TestCase*> skipped_tests;
static std::map<std::string, int>& getTestTagsSkipCounts()
{
@@ -26,7 +26,7 @@ static std::map<std::string, int>& getTestTagsSkipExtraCounts()
void testTagIncreaseSkipCount(const std::string& tag, bool isMain, bool appendSkipTests)
{
if (appendSkipTests)
skipped_tests.push_back(::testing::UnitTest::GetInstance()->current_test_info());
skipped_tests.push_back(::testing::UnitTest::GetInstance()->current_test_case());
std::map<std::string, int>& counts = isMain ? getTestTagsSkipCounts() : getTestTagsSkipExtraCounts();
std::map<std::string, int>::iterator i = counts.find(tag);
if (i == counts.end())
@@ -280,6 +280,11 @@ static bool isTestTagSkipped(const std::string& testTag, CV_OUT std::string& ski
void checkTestTags()
{
if (std::find(skipped_tests.begin(), skipped_tests.end(),
::testing::UnitTest::GetInstance()->current_test_case()) != skipped_tests.end()) {
throw details::SkipTestExceptionBase(false);
}
std::string skipTag;
const std::vector<std::string>& testTags = currentDirectTestTags;
{
@@ -307,7 +312,7 @@ void checkTestTags()
}
if (found != tags.size())
{
skipped_tests.push_back(::testing::UnitTest::GetInstance()->current_test_info());
skipped_tests.push_back(::testing::UnitTest::GetInstance()->current_test_case());
throw details::SkipTestExceptionBase("Test tags don't pass required tags list (--test_tag parameter)", true);
}
}
@@ -341,7 +346,7 @@ void checkTestTags()
if (!skip_message.empty())
{
skipped_tests.push_back(::testing::UnitTest::GetInstance()->current_test_info());
skipped_tests.push_back(::testing::UnitTest::GetInstance()->current_test_case());
throw details::SkipTestExceptionBase(skip_message, true);
}
}