Fix tests with newer pytest versions.