Backport mpmath's fix for py.test from https://github.com/fredrik-johansson/mpmath/pull/17
Merge pull request #8099 from skirpichev/py.test-mpmath

Backport mpmath's fix for py.test