Test for 3.11 support (#2612)

Co-authored-by: Zhiwei <zhi.wei.liang@outlook.com>
This commit is contained in:
Adam Hopkins 2022-12-17 23:46:22 +02:00 committed by GitHub
parent 154863d6c6
commit bfb54b0969
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 62 additions and 10 deletions

View File

@ -20,6 +20,7 @@ jobs:
- { python-version: 3.8, tox-env: security} - { python-version: 3.8, tox-env: security}
- { python-version: 3.9, tox-env: security} - { python-version: 3.9, tox-env: security}
- { python-version: "3.10", tox-env: security} - { python-version: "3.10", tox-env: security}
- { python-version: "3.11", tox-env: security}
steps: steps:
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@v2 uses: actions/checkout@v2

View File

@ -14,7 +14,7 @@ jobs:
strategy: strategy:
matrix: matrix:
config: config:
- {python-version: "3.8", tox-env: "docs"} - {python-version: "3.10", tox-env: "docs"}
fail-fast: false fail-fast: false

View File

@ -16,7 +16,7 @@ jobs:
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
config: config:
- { python-version: 3.8, tox-env: lint} - { python-version: "3.10", tox-env: lint}
steps: steps:
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@v2 uses: actions/checkout@v2

47
.github/workflows/pr-python311.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: Python 3.11 Tests
on:
pull_request:
branches:
- main
- "*LTS"
types: [opened, synchronize, reopened, ready_for_review]
jobs:
testPy311:
if: github.event.pull_request.draft == false
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.11",
tox-env: py311,
ignore-error-flake: "false",
command-timeout: "0",
}
- {
python-version: "3.11",
tox-env: py311-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"

View File

@ -20,6 +20,7 @@ jobs:
- { python-version: 3.8, tox-env: type-checking} - { python-version: 3.8, tox-env: type-checking}
- { python-version: 3.9, tox-env: type-checking} - { python-version: 3.9, tox-env: type-checking}
- { python-version: "3.10", tox-env: type-checking} - { python-version: "3.10", tox-env: type-checking}
- { python-version: "3.11", tox-env: type-checking}
steps: steps:
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@v2 uses: actions/checkout@v2

View File

@ -19,6 +19,7 @@ jobs:
- { python-version: 3.8, tox-env: py38-no-ext } - { python-version: 3.8, tox-env: py38-no-ext }
- { python-version: 3.9, tox-env: py39-no-ext } - { python-version: 3.9, tox-env: py39-no-ext }
- { python-version: "3.10", tox-env: py310-no-ext } - { python-version: "3.10", tox-env: py310-no-ext }
- { python-version: "3.11", tox-env: py310-no-ext }
- { python-version: pypy-3.7, tox-env: pypy37-no-ext } - { python-version: pypy-3.7, tox-env: pypy37-no-ext }
steps: steps:

View File

@ -14,7 +14,7 @@ jobs:
strategy: strategy:
fail-fast: true fail-fast: true
matrix: matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"] python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps: steps:
- name: Checkout repository - name: Checkout repository

View File

@ -11,7 +11,7 @@ jobs:
strategy: strategy:
fail-fast: true fail-fast: true
matrix: matrix:
python-version: ["3.8"] python-version: ["3.10"]
steps: steps:
- name: Checkout Repository - name: Checkout Repository

View File

@ -22,5 +22,6 @@ module = [
"httptools.*", "httptools.*",
"trustme.*", "trustme.*",
"sanic_routing.*", "sanic_routing.*",
"aioquic.*",
] ]
ignore_missing_imports = true ignore_missing_imports = true

View File

@ -442,7 +442,7 @@ class Blueprint(BaseSanic):
events.add(signal.ctx.event) events.add(signal.ctx.event)
return asyncio.wait( return asyncio.wait(
[event.wait() for event in events], [asyncio.create_task(event.wait()) for event in events],
return_when=asyncio.FIRST_COMPLETED, return_when=asyncio.FIRST_COMPLETED,
timeout=timeout, timeout=timeout,
) )

View File

@ -90,6 +90,7 @@ setup_kwargs = {
"Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
], ],
"entry_points": {"console_scripts": ["sanic = sanic.__main__:main"]}, "entry_points": {"console_scripts": ["sanic = sanic.__main__:main"]},
} }

View File

@ -314,10 +314,10 @@ async def test_dispatch_signal_triggers_event_on_bp(app):
waiter = bp.event("foo.bar.baz") waiter = bp.event("foo.bar.baz")
assert isawaitable(waiter) assert isawaitable(waiter)
fut = asyncio.ensure_future(do_wait()) fut = do_wait()
for signal in signal_group: for signal in signal_group:
signal.ctx.event.set() signal.ctx.event.set()
await fut await asyncio.gather(fut)
assert bp_counter == 1 assert bp_counter == 1

View File

@ -1,11 +1,11 @@
[tox] [tox]
envlist = py37, py38, py39, py310, pyNightly, pypy37, {py37,py38,py39,py310,pyNightly,pypy37}-no-ext, lint, check, security, docs, type-checking envlist = py37, py38, py39, py310, py311, pyNightly, pypy37, {py37,py38,py39,py310,py311,pyNightly,pypy37}-no-ext, lint, check, security, docs, type-checking
[testenv] [testenv]
usedevelop = true usedevelop = true
setenv = setenv =
{py37,py38,py39,py310,pyNightly}-no-ext: SANIC_NO_UJSON=1 {py37,py38,py39,py310,py311,pyNightly}-no-ext: SANIC_NO_UJSON=1
{py37,py38,py39,py310,pyNightly}-no-ext: SANIC_NO_UVLOOP=1 {py37,py38,py39,py310,py311,pyNightly}-no-ext: SANIC_NO_UVLOOP=1
extras = test, http3 extras = test, http3
deps = deps =
httpx==0.23 httpx==0.23