Don't delete the list of mocked functions between tests
Only use patchwork functions if they're actually available
Reorder some of the teardown routine