self_test will throw an ImportError if pytest is not installed

This is a very simple patch to #736