TST/CLN: centralize module check funcs

- Moved duplicated module check functions to `util.testing`
- Remove some unnecessary import