From 126a1650a83c70db5d57d78885d162e97ff552c6 Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Thu, 21 Dec 2023 18:42:01 +0000 Subject: [PATCH] fix "run-on-arch" tests (#1131) --- .github/workflows/ci.yml | 4 ++-- tests/requirements.txt | 4 +++- tests/test_docstrings.py | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb0918f8a..53506f45b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -643,11 +643,11 @@ jobs: if command -v apt-get &> /dev/null; then echo "installing python & pip with apt-get..." apt-get update - apt-get install -y --no-install-recommends python3 python3-pip python3-venv + apt-get install -y --no-install-recommends python3 python3-pip python3-venv git else echo "installing python & pip with apk..." apk update - apk add python3 py3-pip + apk add python3 py3-pip git fi run: | set -x diff --git a/tests/requirements.txt b/tests/requirements.txt index 66dda075f..7a915f483 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -6,7 +6,9 @@ pandas==2.0.3; python_version >= "3.9" and python_version < "3.12" and implement pytest==7.4.3 # we run codspeed benchmarks on x86_64 CPython (i.e. native github actions architecture) pytest-codspeed~=2.2.0; implementation_name == "cpython" and platform_machine == 'x86_64' -pytest-examples==0.0.10 +# pytest-examples currently depends on aiohttp via black; we don't want to build +# it on platforms like aarch64 musllinux in CI +pytest-examples==0.0.10; implementation_name == "cpython" and platform_machine == 'x86_64' pytest-speed==0.3.5 pytest-mock==3.11.1 pytest-pretty==1.2.0 diff --git a/tests/test_docstrings.py b/tests/test_docstrings.py index fb729723f..25f5bf1e4 100644 --- a/tests/test_docstrings.py +++ b/tests/test_docstrings.py @@ -12,7 +12,7 @@ def find_examples(*_directories): return [] -@pytest.mark.skipif(sys.platform not in {'linux', 'darwin'}, reason='Only on linux and macos') +@pytest.mark.skipif(CodeExample is None or sys.platform not in {'linux', 'darwin'}, reason='Only on linux and macos') @pytest.mark.parametrize('example', find_examples('python/pydantic_core/core_schema.py'), ids=str) def test_docstrings(example: CodeExample, eval_example: EvalExample): eval_example.set_config(quotes='single') @@ -25,7 +25,7 @@ def test_docstrings(example: CodeExample, eval_example: EvalExample): eval_example.run_print_check(example) -@pytest.mark.skipif(sys.platform not in {'linux', 'darwin'}, reason='Only on linux and macos') +@pytest.mark.skipif(CodeExample is None or sys.platform not in {'linux', 'darwin'}, reason='Only on linux and macos') @pytest.mark.parametrize('example', find_examples('README.md'), ids=str) def test_readme(example: CodeExample, eval_example: EvalExample): eval_example.set_config(line_length=100, quotes='single')