add clear_warnings before running tests and then check for warnings

Merge @stdweird's changes that I missed somehow.