Add passing 3.11 CI by exempting blackd tests (#3234)
- Had to exempt blackd tests for now due to aiohttp - Skip by using `sys.version_info` tuple - aiohttp does not compile in 3.11 yet - refer to #3230 - Add a deadsnakes ubuntu workflow to run 3.11-dev to ensure we don't regress - Have it also format ourselves Test: - `tox -e 311` Co-authored-by: Cooper Ry Lees <me@wcooperlees.com> Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
This commit is contained in:
parent
6e0ad52e7a
commit
59acf8af38
57
.github/workflows/test-311.yml
vendored
Normal file
57
.github/workflows/test-311.yml
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
name: Partially test 3.11 dev
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- "docs/**"
|
||||
- "*.md"
|
||||
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- "docs/**"
|
||||
- "*.md"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
main:
|
||||
# We want to run on external PRs, but not on our own internal PRs as they'll be run
|
||||
# by the push to the branch. Without this if check, checks are duplicated since
|
||||
# internal PRs match both the push and pull_request events.
|
||||
if:
|
||||
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
|
||||
github.repository
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.11.0-rc - 3.11"]
|
||||
os: [ubuntu-latest, macOS-latest, windows-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install tox
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install --upgrade tox
|
||||
|
||||
- name: Run tests via tox
|
||||
run: |
|
||||
python -m tox -e 311
|
||||
|
||||
- name: Format ourselves
|
||||
run: |
|
||||
python -m pip install .
|
||||
python -m black --check src/
|
@ -69,6 +69,8 @@
|
||||
|
||||
<!-- Changes to how Black is packaged, such as dependency requirements -->
|
||||
|
||||
- Python 3.11 is now supported, except for `blackd` (#3234)
|
||||
|
||||
### Parser
|
||||
|
||||
<!-- Changes to the parser or to version autodetection -->
|
||||
|
1
setup.py
1
setup.py
@ -127,6 +127,7 @@ def find_python_files(base: Path) -> List[Path]:
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
"Topic :: Software Development :: Quality Assurance",
|
||||
|
@ -1,4 +1,5 @@
|
||||
import re
|
||||
import sys
|
||||
from typing import Any
|
||||
from unittest.mock import patch
|
||||
|
||||
@ -7,6 +8,9 @@
|
||||
|
||||
from tests.util import DETERMINISTIC_HEADER, read_data
|
||||
|
||||
LESS_THAN_311 = sys.version_info < (3, 11)
|
||||
|
||||
if LESS_THAN_311: # noqa: C901
|
||||
try:
|
||||
from aiohttp import web
|
||||
from aiohttp.test_utils import AioHTTPTestCase
|
||||
@ -23,7 +27,6 @@
|
||||
def unittest_run_loop(func: Any, *args: Any, **kwargs: Any) -> Any:
|
||||
return func
|
||||
|
||||
|
||||
@pytest.mark.blackd
|
||||
class BlackDTestCase(AioHTTPTestCase):
|
||||
def test_blackd_main(self) -> None:
|
||||
@ -77,7 +80,9 @@ async def test_blackd_supported_version(self) -> None:
|
||||
async def test_blackd_invalid_python_variant(self) -> None:
|
||||
async def check(header_value: str, expected_status: int = 400) -> None:
|
||||
response = await self.client.post(
|
||||
"/", data=b"what", headers={blackd.PYTHON_VARIANT_HEADER: header_value}
|
||||
"/",
|
||||
data=b"what",
|
||||
headers={blackd.PYTHON_VARIANT_HEADER: header_value},
|
||||
)
|
||||
self.assertEqual(response.status, expected_status)
|
||||
|
||||
@ -163,7 +168,9 @@ async def test_blackd_line_length(self) -> None:
|
||||
@unittest_run_loop
|
||||
async def test_blackd_invalid_line_length(self) -> None:
|
||||
response = await self.client.post(
|
||||
"/", data=b'print("hello")\n', headers={blackd.LINE_LENGTH_HEADER: "NaN"}
|
||||
"/",
|
||||
data=b'print("hello")\n',
|
||||
headers={blackd.LINE_LENGTH_HEADER: "NaN"},
|
||||
)
|
||||
self.assertEqual(response.status, 400)
|
||||
|
||||
|
27
tox.ini
27
tox.ini
@ -1,5 +1,5 @@
|
||||
[tox]
|
||||
envlist = {,ci-}py{36,37,38,39,310,py3},fuzz,run_self
|
||||
envlist = {,ci-}py{36,37,38,39,310,311,py3},fuzz,run_self
|
||||
|
||||
[testenv]
|
||||
setenv = PYTHONPATH = {toxinidir}/src
|
||||
@ -50,6 +50,31 @@ commands =
|
||||
--cov --cov-append {posargs}
|
||||
coverage report
|
||||
|
||||
[testenv:{,ci-}311]
|
||||
setenv = PYTHONPATH = {toxinidir}/src
|
||||
skip_install = True
|
||||
recreate = True
|
||||
deps =
|
||||
-r{toxinidir}/test_requirements.txt
|
||||
; a separate worker is required in ci due to https://foss.heptapod.net/pypy/pypy/-/issues/3317
|
||||
; this seems to cause tox to wait forever
|
||||
; remove this when pypy releases the bugfix
|
||||
commands =
|
||||
pip install -e .
|
||||
coverage erase
|
||||
pytest tests \
|
||||
--run-optional no_jupyter \
|
||||
!ci: --numprocesses auto \
|
||||
ci: --numprocesses 1 \
|
||||
--cov {posargs}
|
||||
pip install -e .[jupyter]
|
||||
pytest tests --run-optional jupyter \
|
||||
-m jupyter \
|
||||
!ci: --numprocesses auto \
|
||||
ci: --numprocesses 1 \
|
||||
--cov --cov-append {posargs}
|
||||
coverage report
|
||||
|
||||
[testenv:fuzz]
|
||||
skip_install = True
|
||||
deps =
|
||||
|
Loading…
Reference in New Issue
Block a user