Skip to content

Commit 03dd713

Browse files
mgornyhynek
andauthored
Do not require cloudpickle for PyPy (#892)
* Do not require cloudpickle for PyPy 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. * Enable testing on pypy-3.8 * add a news entry Co-authored-by: Hynek Schlawack <[email protected]>
1 parent ce50f40 commit 03dd713

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "pypy-2.7", "pypy-3.7"]
25+
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "pypy-2.7", "pypy-3.7", "pypy-3.8"]
2626

2727
steps:
2828
- uses: actions/checkout@v2

changelog.d/892.change.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed the test suite on PyPy3.8 where cloudpickle does not work.

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"docs": ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"],
5151
"tests_no_zope": [
5252
# For regression test to ensure cloudpickle compat doesn't break.
53-
"cloudpickle",
53+
'cloudpickle; python_implementation == "CPython"',
5454
# 5.0 introduced toml; parallel was broken until 5.0.2
5555
"coverage[toml]>=5.0.2",
5656
"hypothesis",

tests/test_3rd_party.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
Tests for compatibility against other Python modules.
55
"""
66

7-
import cloudpickle
7+
import pytest
88

99
from hypothesis import given
1010

1111
from .strategies import simple_classes
1212

1313

14+
cloudpickle = pytest.importorskip("cloudpickle")
15+
16+
1417
class TestCloudpickleCompat(object):
1518
"""
1619
Tests for compatibility with ``cloudpickle``.

0 commit comments

Comments
 (0)