The test was not using qutebrowsers DiskCache class at all but Qts QNetworkDiskCache. As a result the code paths of DiskCache.remove() were never visited.