Remove spurious tracebacks from tests

Some tests were deleting stacks in the background, thus provoking
tracebacks displayed later on during tests run. The patch waits for the
delete threads to prevent that.

Closes-Bug: #1278836
Closes-Bug: #1278937
Change-Id: I4b90eb6f90168803445039f9588a3052def6636a
Merge "Remove spurious tracebacks from tests"