Skip to content

Commit

Permalink
Add support for Python 3.12 and drop 3.7 (#1297)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Jan 10, 2024
1 parent 04144bd commit 4177852
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 37 deletions.
26 changes: 10 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3"

sphinx:
configuration: docs/conf.py
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 5 additions & 7 deletions src/socketio/tornado.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 0 additions & 2 deletions tests/async/test_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import asyncio
import sys
import unittest
from unittest import mock

Expand All @@ -13,7 +12,6 @@
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()
Expand Down
2 changes: 0 additions & 2 deletions tests/async/test_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
import unittest
from unittest import mock

Expand All @@ -7,7 +6,6 @@
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
Expand Down
2 changes: 0 additions & 2 deletions tests/async/test_pubsub_manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import asyncio
import functools
import sys
import unittest
from unittest import mock

Expand All @@ -12,7 +11,6 @@
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
Expand Down
2 changes: 0 additions & 2 deletions tests/async/test_server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import asyncio
import logging
import sys
import unittest
from unittest import mock

Expand All @@ -16,7 +15,6 @@
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()})
Expand Down
2 changes: 0 additions & 2 deletions tests/common/test_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import sys
import unittest
from unittest import mock

Expand Down Expand Up @@ -155,7 +154,6 @@ def __init__(self, n):
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
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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]
Expand Down

0 comments on commit 4177852

Please sign in to comment.