From e33e8d5541aa3a5feab23969609a18f89882f81c Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Wed, 5 Apr 2023 15:30:17 +0200 Subject: [PATCH 1/5] CI: Add GHA tests (#90) --- .github/workflows/tests.yml | 76 +++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..b5f7f9a --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,76 @@ +name: tests + +on: + push: + paths-ignore: + - "*.md" + pull_request: + types: [opened, synchronize, reopened, edited] + paths-ignore: + - "*.md" + +env: + MODULE_NAME: 'srsly' + RUN_MYPY: 'false' + +jobs: + tests: + name: Test + if: github.repository_owner == 'explosion' + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python_version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + include: + - os: windows-2019 + python_version: "3.6" + - os: ubuntu-20.04 + python_version: "3.6" + runs-on: ${{ matrix.os }} + + steps: + - name: Check out repo + uses: actions/checkout@v3 + + - name: Configure Python version + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python_version }} + architecture: x64 + + - name: Build sdist + run: | + python -m pip install -U build pip setuptools + python -m pip install -U -r requirements.txt + python -m build --sdist + + - name: Delete source directory + shell: bash + run: | + rm -rf $MODULE_NAME + + - name: Uninstall all packages + run: | + python -m pip freeze > installed.txt + python -m pip uninstall -y -r installed.txt + + - name: Install from sdist + shell: bash + run: | + SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1) + python -m pip install dist/$SDIST + + - name: Test import + shell: bash + run: | + python -c "import $MODULE_NAME" -Werror + + - name: Install test requirements + run: | + python -m pip install -U -r requirements.txt + + - name: Run tests + shell: bash + run: | + python -m pytest --pyargs $MODULE_NAME -Werror From 0eed0373b8eca681b3899bb4ad259bf55753f7ac Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Thu, 20 Apr 2023 14:09:55 +0200 Subject: [PATCH 2/5] CI: Switch from Azure to GHA (#91) * CI: Switch from Azure to GHA * Call pytest without -Werror --- .github/workflows/tests.yml | 2 +- README.md | 2 +- azure-pipelines.yml | 102 ------------------------------------ 3 files changed, 2 insertions(+), 104 deletions(-) delete mode 100644 azure-pipelines.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b5f7f9a..994deae 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -73,4 +73,4 @@ jobs: - name: Run tests shell: bash run: | - python -m pytest --pyargs $MODULE_NAME -Werror + python -m pytest --pyargs $MODULE_NAME diff --git a/README.md b/README.md index 9a6a8b9..aa1d252 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ standalone package, with a high-level API that makes it easy to write code that's correct across platforms and Pythons. This allows us to provide all the serialization utilities we need in a single binary wheel. -[![Azure Pipelines](https://img.shields.io/azure-devops/build/explosion-ai/public/4/master.svg?logo=azure-pipelines&style=flat-square)](https://dev.azure.com/explosion-ai/public/_build?definitionId=4) +[![tests](https://github.com/explosion/srsly/actions/workflows/tests.yml/badge.svg)](https://github.com/explosion/srsly/actions/workflows/tests.yml) [![PyPi](https://img.shields.io/pypi/v/srsly.svg?style=flat-square&logo=pypi&logoColor=white)](https://pypi.python.org/pypi/srsly) [![conda](https://img.shields.io/conda/vn/conda-forge/srsly.svg?style=flat-square&logo=conda-forge&logoColor=white)](https://anaconda.org/conda-forge/srsly) [![GitHub](https://img.shields.io/github/release/explosion/srsly/all.svg?style=flat-square&logo=github)](https://github.com/explosion/srsly) diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index b0686de..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,102 +0,0 @@ -trigger: - batch: true - branches: - include: - - '*' - -jobs: - -- job: 'Test' - strategy: - matrix: - Python36Linux: - imageName: 'ubuntu-latest' - python.version: '3.6' - Python36Windows: - imageName: 'windows-2019' - python.version: '3.6' - Python37Linux: - imageName: 'ubuntu-latest' - python.version: '3.7' - Python37Windows: - imageName: 'windows-latest' - python.version: '3.7' - Python37Mac: - imageName: 'macos-latest' - python.version: '3.7' - Python38Linux: - imageName: 'ubuntu-latest' - python.version: '3.8' - Python38Windows: - imageName: 'windows-latest' - python.version: '3.8' - Python38Mac: - imageName: 'macos-latest' - python.version: '3.8' - Python39Linux: - imageName: 'ubuntu-latest' - python.version: '3.9' - Python39Windows: - imageName: 'windows-latest' - python.version: '3.9' - Python39Mac: - imageName: 'macos-latest' - python.version: '3.9' - Python310Linux: - imageName: 'ubuntu-latest' - python.version: '3.10' - Python310Windows: - imageName: 'windows-latest' - python.version: '3.10' - Python310Mac: - imageName: 'macos-latest' - python.version: '3.10' - Python311Linux: - imageName: 'ubuntu-latest' - python.version: '3.11.0-rc.2' - Python311Windows: - imageName: 'windows-latest' - python.version: '3.11.0-rc.2' - Python311Mac: - imageName: 'macos-latest' - python.version: '3.11.0-rc.2' - maxParallel: 4 - pool: - vmImage: $(imageName) - - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - architecture: 'x64' - allowUnstable: true - - - script: | - python -m pip install --upgrade pip setuptools - pip install -r requirements.txt - displayName: 'Install dependencies' - - - script: | - python setup.py build_ext --inplace - python setup.py sdist --formats=gztar - displayName: 'Build sdist' - - - task: DeleteFiles@1 - inputs: - contents: 'srsly' - displayName: 'Delete source directory' - - - script: | - pip freeze > installed.txt - pip uninstall -y -r installed.txt - displayName: 'Uninstall all packages' - - - bash: | - SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1) - pip install dist/$SDIST - displayName: 'Install from sdist' - - - script: | - pip install -r requirements.txt - python -m pytest --pyargs srsly - displayName: 'Run tests' From b10f42ab06d521818dd6375595a606cf57ea5e91 Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Tue, 18 Jul 2023 10:43:12 +0200 Subject: [PATCH 3/5] Update dev requirements --- requirements.txt | 2 -- srsly/tests/ujson/test_ujson.py | 1 - 2 files changed, 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index f3a1b44..f9481a5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,8 +2,6 @@ cython>=0.29.1,<3.0 pytest>=5.2.0,!=7.1.0 pytest-timeout>=1.3.3,<2.0.0 -unittest2==1.1.0; python_version < "3.4" -pytz==2018.7 mock>=2.0.0,<3.0.0 numpy>=1.15.0 psutil diff --git a/srsly/tests/ujson/test_ujson.py b/srsly/tests/ujson/test_ujson.py index c736bdf..777754a 100644 --- a/srsly/tests/ujson/test_ujson.py +++ b/srsly/tests/ujson/test_ujson.py @@ -10,7 +10,6 @@ import math import time import sys -import pytz import pytest if six.PY2: From 05c7704780cec4d35786618d7988770987893573 Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Fri, 4 Nov 2022 12:13:45 +0100 Subject: [PATCH 4/5] Skip cloudpickle tests that fail for various versions/reasons --- srsly/tests/cloudpickle/cloudpickle_test.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/srsly/tests/cloudpickle/cloudpickle_test.py b/srsly/tests/cloudpickle/cloudpickle_test.py index fe0cf39..1d33369 100644 --- a/srsly/tests/cloudpickle/cloudpickle_test.py +++ b/srsly/tests/cloudpickle/cloudpickle_test.py @@ -870,8 +870,10 @@ def test_builtin_classicmethod(self): @pytest.mark.skipif( - platform.machine() == "aarch64" and sys.version_info[:2] >= (3, 10), - reason="Fails on aarch64 + python 3.10+ in cibuildwheel, currently unable to replicate failure elsewhere") + (platform.machine() == "aarch64" and sys.version_info[:2] >= (3, 10)) + or platform.python_implementation() == "PyPy" + or (sys.version_info[:2] == (3, 10) and sys.version_info >= (3, 10, 8)), + reason="Fails on aarch64 + python 3.10+ in cibuildwheel, currently unable to replicate failure elsewhere; fails sometimes for pypy on conda-forge; fails for python 3.10.8") def test_builtin_classmethod(self): obj = 1.5 # float object @@ -1470,6 +1472,7 @@ def foo(): finally: sys.modules.pop("_faulty_module", None) + @pytest.mark.skip(reason="fails for pytest v7.2.0") def test_dynamic_pytest_module(self): # Test case for pull request https://github.com/cloudpipe/cloudpickle/pull/116 import py @@ -1567,6 +1570,8 @@ def test_namedtuple(self): assert isinstance(depickled_t2, MyTuple) assert depickled_t2 == t2 + @pytest.mark.skipif(platform.python_implementation() == "PyPy", + reason="fails sometimes for pypy on conda-forge") def test_interactively_defined_function(self): # Check that callables defined in the __main__ module of a Python # script (or jupyter kernel) can be pickled / unpickled / executed. From 28bf2dda84257f9bfd5c9c4a4771694c4ad0e6ed Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Tue, 18 Jul 2023 10:57:52 +0200 Subject: [PATCH 5/5] Also skip cloudpickle builtin classmethod tests for python 3.11 --- srsly/tests/cloudpickle/cloudpickle_test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/srsly/tests/cloudpickle/cloudpickle_test.py b/srsly/tests/cloudpickle/cloudpickle_test.py index 1d33369..b293c53 100644 --- a/srsly/tests/cloudpickle/cloudpickle_test.py +++ b/srsly/tests/cloudpickle/cloudpickle_test.py @@ -872,8 +872,10 @@ def test_builtin_classicmethod(self): @pytest.mark.skipif( (platform.machine() == "aarch64" and sys.version_info[:2] >= (3, 10)) or platform.python_implementation() == "PyPy" - or (sys.version_info[:2] == (3, 10) and sys.version_info >= (3, 10, 8)), - reason="Fails on aarch64 + python 3.10+ in cibuildwheel, currently unable to replicate failure elsewhere; fails sometimes for pypy on conda-forge; fails for python 3.10.8") + or (sys.version_info[:2] == (3, 10) and sys.version_info >= (3, 10, 8)) + # Skipping tests on 3.11 due to https://github.com/cloudpipe/cloudpickle/pull/486. + or sys.version_info[:2] == (3, 11), + reason="Fails on aarch64 + python 3.10+ in cibuildwheel, currently unable to replicate failure elsewhere; fails sometimes for pypy on conda-forge; fails for python 3.10.8+ and 3.11") def test_builtin_classmethod(self): obj = 1.5 # float object