Fix tests compatibility with PyPy