From da6f3a2ebb6782d89cb36c66ca682c8cfeaadec8 Mon Sep 17 00:00:00 2001 From: Maciej Urbanski Date: Sun, 24 Oct 2021 01:59:41 +0200 Subject: [PATCH] test against python 3.10 --- .github/workflows/build.yml | 4 ++-- .github/workflows/test_install.yml | 4 ++-- setup.py | 25 +++++++++++++++++++++++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc97af96e..dabbb701a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,7 +50,7 @@ jobs: name: ๐Ÿงช Unit tests strategy: matrix: - python: ["2.7", "3.7", "3.8", "3.9"] + python: ["2.7", "3.7", "3.8", "3.9", "3.10"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -70,7 +70,7 @@ jobs: needs: build strategy: matrix: - python: ["2.7", "3.7", "3.8", "3.9"] + python: ["2.7", "3.7", "3.8", "3.9", "3.10"] installable: ["wheel", "sdist"] runs-on: ubuntu-latest steps: diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index ba2dc5875..8a848511c 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: os: ["ubuntu-latest"] - python: ["2.7", "3.7", "3.8", "3.9"] + python: ["2.7", "3.7", "3.8", "3.9", "3.10"] branch: ["master"] runs-on: ${{ matrix.os }} steps: @@ -49,7 +49,7 @@ jobs: strategy: matrix: os: ["ubuntu-latest"] - python: ["2.7", "3.7", "3.8", "3.9"] + python: ["2.7", "3.7", "3.8", "3.9", "3.10"] runs-on: ${{ matrix.os }} steps: - name: ๐Ÿ‘€ Determine latest release diff --git a/setup.py b/setup.py index 73b89f827..29476a968 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- import os +import re import sys from distutils.command.build_py import build_py as _build_py @@ -102,8 +103,10 @@ INSTALL_REQUIRES_OSX = [ EXTRA_REQUIRES = { "develop": [ # Testing dependencies - "mock>=3.0.5,<4", - "pytest==4.6.10", + "mock>=3.0.5,<4 ; python_version < '3'", + "pytest==4.6.10 ; python_version < '3'", + "mock>=4,<5 ; python_version >= '3'", + "pytest>=6.2.5,<7 ; python_version >= '3'", "pytest-doctest-custom>=1.0.0,<2", "ddt", # pre-commit @@ -133,6 +136,22 @@ if int(setuptools.__version__.split(".", 1)[0]) < 18: assert "bdist_wheel" not in sys.argv # add optional dependencies for setuptools versions < 18 that don't yet support environment markers + def _filter_by_python_version_marker(requirements): + for requirement in requirements: + req_match = re.match( + r"^(?P.+);\s*(?Ppython_version.+)$", requirement + ) + if not req_match: + yield requirement + else: + if eval(req_match.group("marker"), {}, {"python_version": sys.version}): + yield req_match.group("req") + + EXTRA_REQUIRES = { + extra: list(_filter_by_python_version_marker(extra_requirements)) + for extra, extra_requirements in EXTRA_REQUIRES.items() + } + if sys.version_info[0] < 3: INSTALL_REQUIRES += INSTALL_REQUIRES_PYTHON2 else: @@ -273,6 +292,8 @@ def params(): "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: JavaScript", "Topic :: Printing",