Skip to content

Commit 4177852

Browse files
authored
Add support for Python 3.12 and drop 3.7 (#1297)
1 parent 04144bd commit 4177852

File tree

10 files changed

+19
-37
lines changed

10 files changed

+19
-37
lines changed

.github/workflows/tests.yml

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
name: build
2-
on:
3-
push:
4-
branches:
5-
- main
6-
pull_request:
7-
branches:
8-
- main
2+
on: [push, pull_request, workflow_dispatch]
93
jobs:
104
lint:
115
name: lint
126
runs-on: ubuntu-latest
137
steps:
14-
- uses: actions/checkout@v3
15-
- uses: actions/setup-python@v3
8+
- uses: actions/checkout@v4
9+
- uses: actions/setup-python@v5
1610
- run: python -m pip install --upgrade pip wheel
1711
- run: pip install tox tox-gh-actions
1812
- run: tox -eflake8
@@ -21,17 +15,17 @@ jobs:
2115
name: tests
2216
strategy:
2317
matrix:
24-
os: [ubuntu-latest, macos-latest, windows-latest]
25-
python: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.9']
18+
os: [windows-latest, macos-latest, ubuntu-latest]
19+
python: ['pypy-3.10', '3.8', '3.9', '3.10', '3.11', '3.12']
2620
exclude:
2721
# pypy3 currently fails to run on Windows
2822
- os: windows-latest
29-
python: pypy-3.9
23+
python: pypy-3.10
3024
fail-fast: false
3125
runs-on: ${{ matrix.os }}
3226
steps:
33-
- uses: actions/checkout@v3
34-
- uses: actions/setup-python@v3
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-python@v5
3529
with:
3630
python-version: ${{ matrix.python }}
3731
- run: python -m pip install --upgrade pip wheel
@@ -41,8 +35,8 @@ jobs:
4135
name: coverage
4236
runs-on: ubuntu-latest
4337
steps:
44-
- uses: actions/checkout@v3
45-
- uses: actions/setup-python@v3
38+
- uses: actions/checkout@v4
39+
- uses: actions/setup-python@v5
4640
- run: python -m pip install --upgrade pip wheel
4741
- run: pip install tox tox-gh-actions
4842
- run: tox

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
build:
44
os: ubuntu-22.04
55
tools:
6-
python: "3.11"
6+
python: "3"
77

88
sphinx:
99
configuration: docs/conf.py

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ classifiers = [
1212
"License :: OSI Approved :: MIT License",
1313
"Operating System :: OS Independent",
1414
]
15-
requires-python = ">=3.6"
15+
requires-python = ">=3.8"
1616
dependencies = [
1717
"bidict >= 0.21.0",
1818
"python-engineio >= 4.8.0",

src/socketio/tornado.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import sys
2-
if sys.version_info >= (3, 5):
3-
try:
4-
from engineio.async_drivers.tornado import get_tornado_handler as \
5-
get_engineio_handler
6-
except ImportError: # pragma: no cover
7-
get_engineio_handler = None
1+
try:
2+
from engineio.async_drivers.tornado import get_tornado_handler as \
3+
get_engineio_handler
4+
except ImportError: # pragma: no cover
5+
get_engineio_handler = None
86

97

108
def get_tornado_handler(socketio_server): # pragma: no cover

tests/async/test_client.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import asyncio
2-
import sys
32
import unittest
43
from unittest import mock
54

@@ -13,7 +12,6 @@
1312
from .helpers import AsyncMock, _run
1413

1514

16-
@unittest.skipIf(sys.version_info < (3, 5), 'only for Python 3.5+')
1715
class TestAsyncClient(unittest.TestCase):
1816
def test_is_asyncio_based(self):
1917
c = async_client.AsyncClient()

tests/async/test_manager.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import sys
21
import unittest
32
from unittest import mock
43

@@ -7,7 +6,6 @@
76
from .helpers import AsyncMock, _run
87

98

10-
@unittest.skipIf(sys.version_info < (3, 5), 'only for Python 3.5+')
119
class TestAsyncManager(unittest.TestCase):
1210
def setUp(self):
1311
id = 0

tests/async/test_pubsub_manager.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import asyncio
22
import functools
3-
import sys
43
import unittest
54
from unittest import mock
65

@@ -12,7 +11,6 @@
1211
from .helpers import AsyncMock, _run
1312

1413

15-
@unittest.skipIf(sys.version_info < (3, 5), 'only for Python 3.5+')
1614
class TestAsyncPubSubManager(unittest.TestCase):
1715
def setUp(self):
1816
id = 0

tests/async/test_server.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import asyncio
22
import logging
3-
import sys
43
import unittest
54
from unittest import mock
65

@@ -16,7 +15,6 @@
1615
from .helpers import AsyncMock, _run
1716

1817

19-
@unittest.skipIf(sys.version_info < (3, 5), 'only for Python 3.5+')
2018
@mock.patch('socketio.server.engineio.AsyncServer', **{
2119
'return_value.generate_id.side_effect': [str(i) for i in range(1, 10)],
2220
'return_value.send_packet': AsyncMock()})

tests/common/test_client.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import logging
2-
import sys
32
import unittest
43
from unittest import mock
54

@@ -155,7 +154,6 @@ def __init__(self, n):
155154
with pytest.raises(ValueError):
156155
c.register_namespace(n)
157156

158-
@unittest.skipIf(sys.version_info < (3, 0), 'only for Python 3')
159157
def test_namespace_handler_wrong_async(self):
160158
class MyNamespace(async_namespace.AsyncClientNamespace):
161159
pass

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[tox]
2-
envlist=flake8,py37,py38,py39,py310,py311,pypy3,docs
2+
envlist=flake8,py{38,39,310,311,312,py3},docs
33
skip_missing_interpreters=True
44

55
[gh-actions]
66
python =
7-
3.7: py37
87
3.8: py38
98
3.9: py39
109
3.10: py310
1110
3.11: py311
11+
3.12: py312
1212
pypy-3: pypy3
1313

1414
[testenv]

0 commit comments

Comments
 (0)