threading has no easy way to get the return value or exception once the target function stops. Not checking the return value or exception can make tests more fragile and failures harder to debug.
Fix this by checking the return value (or exception) by wrapping the function execution into a future and calling result() on it.
Can be reviewed with --ignore-all-space.
(There are still some uses of threading around, because some tests do expect an exception to be thrown and caught in the target function)