Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.4
-
None
Description
As milianw pointed out in a recent mail to development, some projects have to test in environments where there are unavoidable messages they have to put up with, whose source and triggers are not under the test's control.
To alleviate this, we could provide some mechanism for the test (ideally as early as the test-object's construction, certainly no later than initTestCase()) to register some messages or regexes, that'll suppress all matching messages in the whole test run, rather than only the first such in the present test function.
QTest registers its message logger in QTest::qInit(), at the start of QTest::qExec(), after the test-class has been instantiated and QTest::setMainSourcePath() has registered relevant paths. It deregisters it in QTest::qCleanup(), at the end of QTest::qExec().
So QTest can only suppress such messages in that interval.
Failure to produce such messages should not be an error (as it is for ignoreMessage()), but perhaps verbose test runs could report, when finished, how many were suppressed – including reporting that none were, if that happens, so that test maintainers can tell when they no longer need such suppression.
Attachments
Issue Links
- relates to
-
QTBUG-107659 QMessageLogger provides no way to suppress a warning from QT_FATAL_WARNINGS's count
- Reported
- resulted from
-
QTBUG-107185 Some tests appear to be re-testing the exact same data tag
- Closed