Skip to content

Commit

Permalink
Add Python 3.10 testing (and support) (#2257)
Browse files Browse the repository at this point in the history
Administratively merging because @vltr and @ahopkins are the release managers, and @ahopkins is originator of the PR

* Add Python 3.10 testing (and support)

* fixed py310 tox environment for windows, quoted '3.10' in python-310 tests to avoid numeric compression

* updated tox.ini for py310

* quoted the rest of the bare 3.10 references in the workflows

* Issue with pytest requires version bump to 6.2.5 for python 3.10

Co-authored-by: Stephen Sadowski <stephen.sadowski@sjsadowski.com>
  • Loading branch information
ahopkins and sjsadowski committed Oct 28, 2021
1 parent 6c7df68 commit f5bd6e3
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr-bandit.yml
Expand Up @@ -16,6 +16,7 @@ jobs:
- { python-version: 3.7, tox-env: security}
- { python-version: 3.8, tox-env: security}
- { python-version: 3.9, tox-env: security}
- { python-version: "3.10", tox-env: security}
steps:
- name: Checkout the repository
uses: actions/checkout@v2
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/pr-python310.yml
@@ -0,0 +1,50 @@
name: Python 3.10 Tests
on:
pull_request:
branches:
- main
push:
branches:
- main
paths:
- sanic/*
- tests/*

jobs:
testPy39:
name: ut-${{ matrix.config.tox-env }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
config:
- {
python-version: "3.10",
tox-env: py310,
ignore-error-flake: "false",
command-timeout: "0",
}
- {
python-version: "3.10",
tox-env: py310-no-ext,
ignore-error-flake: "true",
command-timeout: "600000",
}
steps:
- name: Checkout the Repository
uses: actions/checkout@v2
id: checkout-branch

- name: Run Unit Tests
uses: harshanarayana/custom-actions@main
with:
python-version: ${{ matrix.config.python-version }}
test-infra-tool: tox
test-infra-version: latest
action: tests
test-additional-args: "-e=${{ matrix.config.tox-env }},-vv=''"
experimental-ignore-error: "${{ matrix.config.ignore-error-flake }}"
command-timeout: "${{ matrix.config.command-timeout }}"
test-failure-retry: "3"
1 change: 1 addition & 0 deletions .github/workflows/pr-type-check.yml
Expand Up @@ -16,6 +16,7 @@ jobs:
- { python-version: 3.7, tox-env: type-checking}
- { python-version: 3.8, tox-env: type-checking}
- { python-version: 3.9, tox-env: type-checking}
- { python-version: "3.10", tox-env: type-checking}
steps:
- name: Checkout the repository
uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-windows.yml
Expand Up @@ -15,6 +15,7 @@ jobs:
- { python-version: 3.7, tox-env: py37-no-ext }
- { python-version: 3.8, tox-env: py38-no-ext }
- { python-version: 3.9, tox-env: py39-no-ext }
- { python-version: "3.10", tox-env: py310-no-ext }
- { python-version: pypy-3.7, tox-env: pypy37-no-ext }

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-images.yml
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.7", "3.8", "3.9"]
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- name: Checkout repository
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -72,6 +72,7 @@ def open_local(paths, mode="r", encoding="utf8"):
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
],
"entry_points": {"console_scripts": ["sanic = sanic.__main__:main"]},
}
Expand All @@ -94,7 +95,7 @@ def open_local(paths, mode="r", encoding="utf8"):

tests_require = [
"sanic-testing>=0.7.0",
"pytest==5.2.1",
"pytest==6.2.5",
"coverage==5.3",
"gunicorn==20.0.4",
"pytest-cov",
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
@@ -1,11 +1,11 @@
[tox]
envlist = py37, py38, py39, pyNightly, pypy37, {py37,py38,py39,pyNightly,pypy37}-no-ext, lint, check, security, docs, type-checking
envlist = py37, py38, py39, py310, pyNightly, pypy37, {py37,py38,py39,py310,pyNightly,pypy37}-no-ext, lint, check, security, docs, type-checking

[testenv]
usedevelop = true
setenv =
{py37,py38,py39,pyNightly}-no-ext: SANIC_NO_UJSON=1
{py37,py38,py39,pyNightly}-no-ext: SANIC_NO_UVLOOP=1
{py37,py38,py39,py310,pyNightly}-no-ext: SANIC_NO_UJSON=1
{py37,py38,py39,py310,pyNightly}-no-ext: SANIC_NO_UVLOOP=1
extras = test
commands =
pytest {posargs:tests --cov sanic}
Expand Down

0 comments on commit f5bd6e3

Please sign in to comment.