tests: Properly delete webengine DownloadManager objects

We create the DownloadManager with parent=qapp, which means they will stick
around forever after the test finished.

While we disconnect the QWebEngineProfile::downloadRequested() signal,
we keep the DownloadManager around, which also keeps around its download-update
timers.

Those will then result in tests/unit/utils/usertypes/test_timer.py::test_early_timeout_check
being flaky, as their _validity_check_handler slot keeps getting called in the
background. Due to the globally mocked time.monotonic(), this results in
nonsensical error messages such as:

    Got logging message on logger misc with level WARNING:
    Timer download-update (id ...) triggered too early:
    interval 500 but only -1023.269s passed!

After this change, we now clean up those objects properly, thus fixing the
flakiness.

See #5390.
This commit is contained in:
Florian Bruhin 2025-05-07 14:06:03 +02:00
parent a4b3ca48df
commit 74c7ff2641
1 changed files with 1 additions and 0 deletions

View File

@ -100,6 +100,7 @@ class TestDataUrlWorkaround:
manager.install(webengine_profile)
yield manager
webengine_profile.downloadRequested.disconnect()
manager.deleteLater()
def test_workaround(self, webengine_tab, message_mock, qtbot,
pdf_url, download_manager, expected_names):