Many functions and especially standalone tools takes the lock itself, so to prevent deadlocks, as a rule execute the tests with lock released. Also reload qubes.xml before cleanup.