From fd48634f964bb644e637797aa14654356857f765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Tue, 28 Dec 2021 09:43:50 +0100 Subject: [PATCH 1/3] 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 import cloudpickle .tox/pypy3/lib/pypy3.8/site-packages/cloudpickle/__init__.py:4: in from cloudpickle.cloudpickle import * # noqa .tox/pypy3/lib/pypy3.8/site-packages/cloudpickle/cloudpickle.py:57: in from .compat import pickle .tox/pypy3/lib/pypy3.8/site-packages/cloudpickle/compat.py:13: in 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. --- setup.py | 2 +- tests/test_3rd_party.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index ce0419f11..00e7b012a 100644 --- a/setup.py +++ b/setup.py @@ -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", diff --git a/tests/test_3rd_party.py b/tests/test_3rd_party.py index 1de6b335f..8866d7f6e 100644 --- a/tests/test_3rd_party.py +++ b/tests/test_3rd_party.py @@ -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``. From d136837ebe9609c7b14f6869291b3494507c9579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 29 Dec 2021 08:25:56 +0100 Subject: [PATCH 2/3] Enable testing on pypy-3.8 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 64296294b..f38fd9150 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "pypy-2.7", "pypy-3.7"] + 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"] steps: - uses: actions/checkout@v2 From 27a2a4e5f443ef4c4d0271686be616a3db765bf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 29 Dec 2021 09:36:06 +0100 Subject: [PATCH 3/3] add a news entry --- changelog.d/892.change.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/892.change.rst diff --git a/changelog.d/892.change.rst b/changelog.d/892.change.rst new file mode 100644 index 000000000..aa2ebcbc9 --- /dev/null +++ b/changelog.d/892.change.rst @@ -0,0 +1 @@ +Fixed the test suite on PyPy3.8 where cloudpickle does not work.