TST/CLN: centralize module check funcs

- Moved duplicated module check functions to `util.testing`
- Remove some unnecessary import
Or leave it local func because `scipy.interpolate` requirement is only checked in `test_generic.py`.