Switch to py.test as per #1479.
Merge branch 'master' into switch-to-pytest
Fix two failing tests from master