A couple of the tests check for specific warning messages, so we need to ensure that the required logging category is enabled.
Details
- Reviewers
dfaure
Tests fail before this patch if turning off all logging for karchive with e. g. kdebugsettings, pass afterwards.
Diff Detail
- Repository
- R243 KArchive
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Forgot that differential doesn't like patches created when git has noprefix turned on.
Is it passing on the CI because somehow we enable warnings on there?
https://build.kde.org/job/Frameworks/job/karchive/job/kf5-qt5%20SUSEQt5.13/60/testReport/
I suggest a better solution: QStandardPaths::setTestModeEnabled(true) in initTestCase().
Then the user settings won't interfere with the unittest.
Yeah, the issue for me was qtlogging.ini, but it's not that far fetched that the user has set QT_LOGGING_RULES manually. Because it's a bit surprising and not obvious why this fails, maybe we could check if the warnings are disabled (e. g. if (!KArchiveLog().isWarningEnabled()) { qWarning()<< "Warnings disabled for" << KArchiveLog().categoryName() << ", the test will probably fail"; }), if not outright calling qunsetenv("QT_LOGGING_RULES");
I like your first suggestion.
I don't like the second one, because QT_LOGGING_RULES is used (by at least CI and myself) to enable *more* debug output. unsetenv would break that.