From 26e293f9b58031ec8a3b87c929bd0cdc2d4b5c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Sat, 31 Dec 2022 17:03:05 +0100 Subject: [PATCH] Skip time-machine dep and spinner tests on PyPy (#2797) The time-machine package is deeply relying on CPython implementation details and causes segfaults on PyPy. Pull the dependency in only on implementations other than PyPy, and skip collecting the spinner tests on PyPy since they require it. --- docs/changelog/2797.misc.rst | 2 ++ pyproject.toml | 2 +- tests/conftest.py | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 docs/changelog/2797.misc.rst diff --git a/docs/changelog/2797.misc.rst b/docs/changelog/2797.misc.rst new file mode 100644 index 000000000..dc2a9e04f --- /dev/null +++ b/docs/changelog/2797.misc.rst @@ -0,0 +1,2 @@ +Skip the ``time-machine`` dependency and spinner tests on PyPy because +it segfaults on this implementation. diff --git a/pyproject.toml b/pyproject.toml index 4e2a44b25..e4735d3a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,7 +59,7 @@ optional-dependencies.testing = [ "pytest-mock>=3.10", "pytest-xdist>=3.1", "re-assert>=1.1", - "time-machine>=2.8.2", + "time-machine>=2.8.2; implementation_name != \"pypy\"", ] scripts.tox = "tox.run:run" dynamic = ["version"] diff --git a/tests/conftest.py b/tests/conftest.py index 81c4a4938..b3086268d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -39,6 +39,12 @@ def _fmt(msg: str) -> str: from typing_extensions import Protocol +collect_ignore = [] +if sys.implementation.name == "pypy": + # time-machine causes segfaults on PyPy + collect_ignore.append("util/test_spinner.py") + + class ToxIniCreator(Protocol): def __call__(self, conf: str, override: Sequence[Override] | None = None) -> Config: # noqa: U100 ...