Skip to content

Commit

Permalink
Do not require cloudpickle for PyPy
Browse files Browse the repository at this point in the history
The cloudpickle package relies on CPython implementation details,
and does not even import on PyPy:

```
ImportError while importing test module '/tmp/attrs/tests/test_3rd_party.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/pypy3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_3rd_party.py:7: in <module>
    import cloudpickle
.tox/pypy3/lib/pypy3.8/site-packages/cloudpickle/__init__.py:4: in <module>
    from cloudpickle.cloudpickle import *  # noqa
.tox/pypy3/lib/pypy3.8/site-packages/cloudpickle/cloudpickle.py:57: in <module>
    from .compat import pickle
.tox/pypy3/lib/pypy3.8/site-packages/cloudpickle/compat.py:13: in <module>
    from _pickle import Pickler  # noqa: F401
E   ModuleNotFoundError: No module named '_pickle'
```

Disable the dependency for PyPy and make the test handle missing
cloudpickle gracefully.
  • Loading branch information
mgorny committed Dec 29, 2021
1 parent 7695908 commit fd48634
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"docs": ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"],
"tests_no_zope": [
# For regression test to ensure cloudpickle compat doesn't break.
"cloudpickle",
'cloudpickle; python_implementation == "CPython"',
# 5.0 introduced toml; parallel was broken until 5.0.2
"coverage[toml]>=5.0.2",
"hypothesis",
Expand Down
5 changes: 4 additions & 1 deletion tests/test_3rd_party.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
Tests for compatibility against other Python modules.
"""

import cloudpickle
import pytest

from hypothesis import given

from .strategies import simple_classes


cloudpickle = pytest.importorskip("cloudpickle")


class TestCloudpickleCompat(object):
"""
Tests for compatibility with ``cloudpickle``.
Expand Down

0 comments on commit fd48634

Please sign in to comment.