diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..994deae --- /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 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' 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/cloudpickle/cloudpickle_test.py b/srsly/tests/cloudpickle/cloudpickle_test.py index fe0cf39..b293c53 100644 --- a/srsly/tests/cloudpickle/cloudpickle_test.py +++ b/srsly/tests/cloudpickle/cloudpickle_test.py @@ -870,8 +870,12 @@ 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)) + # 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 @@ -1470,6 +1474,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 +1572,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. 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: