make self_test not import if pytest is not installed

This is a very simple patch to #736