Fixed a lot of warnings in the test suite
This PR catches a lot of warnings emitted from the test suite, either by catching them appropriately with pytest.warns
(which also acts as a test that the warning gets emitted when it should), or by modifying the test or module code to not produce the warning in the first place.
This should clean up the test output, and make finding problems easier in the future, especially when scanning the warning dump.