Fix bug in running tests when petsc4py is not available.

This is a proposed fix for #264.  @amal-ghamdi, please review.