Run tests with pytest instead of trial

Change #678 base to master instead of pytest branch.