Browse Source

Add support for Python 3.12 and drop 3.7 (#1297)

pull/1298/head
Hugo van Kemenade 1 year ago
committed by GitHub
parent
commit
417785293f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      .github/workflows/tests.yml
  2. 2
      .readthedocs.yaml
  3. 2
      pyproject.toml
  4. 12
      src/socketio/tornado.py
  5. 2
      tests/async/test_client.py
  6. 2
      tests/async/test_manager.py
  7. 2
      tests/async/test_pubsub_manager.py
  8. 2
      tests/async/test_server.py
  9. 2
      tests/common/test_client.py
  10. 4
      tox.ini

26
.github/workflows/tests.yml

@ -1,18 +1,12 @@
name: build
on:
push:
branches:
- main
pull_request:
branches:
- main
on: [push, pull_request, workflow_dispatch]
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: python -m pip install --upgrade pip wheel
- run: pip install tox tox-gh-actions
- run: tox -eflake8
@ -21,17 +15,17 @@ jobs:
name: tests
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.9']
os: [windows-latest, macos-latest, ubuntu-latest]
python: ['pypy-3.10', '3.8', '3.9', '3.10', '3.11', '3.12']
exclude:
# pypy3 currently fails to run on Windows
- os: windows-latest
python: pypy-3.9
python: pypy-3.10
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- run: python -m pip install --upgrade pip wheel
@ -41,8 +35,8 @@ jobs:
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: python -m pip install --upgrade pip wheel
- run: pip install tox tox-gh-actions
- run: tox

2
.readthedocs.yaml

@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3"
sphinx:
configuration: docs/conf.py

2
pyproject.toml

@ -12,7 +12,7 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
requires-python = ">=3.6"
requires-python = ">=3.8"
dependencies = [
"bidict >= 0.21.0",
"python-engineio >= 4.8.0",

12
src/socketio/tornado.py

@ -1,10 +1,8 @@
import sys
if sys.version_info >= (3, 5):
try:
from engineio.async_drivers.tornado import get_tornado_handler as \
get_engineio_handler
except ImportError: # pragma: no cover
get_engineio_handler = None
try:
from engineio.async_drivers.tornado import get_tornado_handler as \
get_engineio_handler
except ImportError: # pragma: no cover
get_engineio_handler = None
def get_tornado_handler(socketio_server): # pragma: no cover

2
tests/async/test_client.py

@ -1,5 +1,4 @@
import asyncio
import sys
import unittest
from unittest import mock
@ -13,7 +12,6 @@ from socketio import packet
from .helpers import AsyncMock, _run
@unittest.skipIf(sys.version_info < (3, 5), 'only for Python 3.5+')
class TestAsyncClient(unittest.TestCase):
def test_is_asyncio_based(self):
c = async_client.AsyncClient()

2
tests/async/test_manager.py

@ -1,4 +1,3 @@
import sys
import unittest
from unittest import mock
@ -7,7 +6,6 @@ from socketio import packet
from .helpers import AsyncMock, _run
@unittest.skipIf(sys.version_info < (3, 5), 'only for Python 3.5+')
class TestAsyncManager(unittest.TestCase):
def setUp(self):
id = 0

2
tests/async/test_pubsub_manager.py

@ -1,6 +1,5 @@
import asyncio
import functools
import sys
import unittest
from unittest import mock
@ -12,7 +11,6 @@ from socketio import packet
from .helpers import AsyncMock, _run
@unittest.skipIf(sys.version_info < (3, 5), 'only for Python 3.5+')
class TestAsyncPubSubManager(unittest.TestCase):
def setUp(self):
id = 0

2
tests/async/test_server.py

@ -1,6 +1,5 @@
import asyncio
import logging
import sys
import unittest
from unittest import mock
@ -16,7 +15,6 @@ from socketio import packet
from .helpers import AsyncMock, _run
@unittest.skipIf(sys.version_info < (3, 5), 'only for Python 3.5+')
@mock.patch('socketio.server.engineio.AsyncServer', **{
'return_value.generate_id.side_effect': [str(i) for i in range(1, 10)],
'return_value.send_packet': AsyncMock()})

2
tests/common/test_client.py

@ -1,5 +1,4 @@
import logging
import sys
import unittest
from unittest import mock
@ -155,7 +154,6 @@ class TestClient(unittest.TestCase):
with pytest.raises(ValueError):
c.register_namespace(n)
@unittest.skipIf(sys.version_info < (3, 0), 'only for Python 3')
def test_namespace_handler_wrong_async(self):
class MyNamespace(async_namespace.AsyncClientNamespace):
pass

4
tox.ini

@ -1,14 +1,14 @@
[tox]
envlist=flake8,py37,py38,py39,py310,py311,pypy3,docs
envlist=flake8,py{38,39,310,311,312,py3},docs
skip_missing_interpreters=True
[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312
pypy-3: pypy3
[testenv]

Loading…
Cancel
Save