[MRG]: fix tests, centralize warnings and reset `__warningregistry__`

@larsmans this tackles the mysterious UnboundLocalError ValueError ...