Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Py3.11 to the supported version list. #224

Merged
merged 10 commits into from
Oct 27, 2022
40 changes: 27 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ jobs:
- 'docs'
- 'package'
steps:
- uses: actions/checkout@v1
- name: Check out code
uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4.3.0
with:
python-version: "3.X"
- name: Install dependencies
Expand All @@ -33,15 +36,18 @@ jobs:
tox -e ${{ matrix.task }}

smoke:
name: Smoke test (3.5)
name: Smoke test (3.7)
needs: beefore
runs-on: macOS-11
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.5
uses: actions/setup-python@v2
- name: Check out code
uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- name: Set up Python 3.7
uses: actions/setup-python@v4.3.0
with:
python-version: 3.5
python-version: "3.7"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -60,11 +66,14 @@ jobs:
platform: ['macOS-12']
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v1
- name: Check out code
uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- name: Set up Python 3.7
uses: actions/setup-python@v2
uses: actions/setup-python@v4.3.0
with:
python-version: 3.7
python-version: "3.7"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -81,11 +90,16 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.5", "3.6", "3.8", "3.9", "3.10", "3.11"]
# As soon as 3.12.0a1 is released:
# python-version: ["3.5", "3.6", "3.8", "3.9", "3.10", "3.11", "3.12.0-alpha - 3.12.0"]
steps:
- uses: actions/checkout@v1
- name: Check out code
uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4.3.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
1 change: 1 addition & 0 deletions changes/224.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for Python 3.11 has been added.
4 changes: 2 additions & 2 deletions rubicon/objc/ctypes_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

# This module relies on the layout of a few internal Python and ctypes structures.
# Because of this, it's possible (but not all that likely) that things will break on newer/older Python versions.
if sys.version_info < (3, 4) or sys.version_info >= (3, 11):
if sys.version_info < (3, 4) or sys.version_info >= (3, 12):
warnings.warn(
"rubicon.objc.ctypes_patch has only been tested with Python 3.4 through 3.10. "
"rubicon.objc.ctypes_patch has only been tested with Python 3.4 through 3.11. "
"You are using Python {v.major}.{v.minor}.{v.micro}. Most likely things will "
"work properly, but you may experience crashes if Python's internals have "
"changed significantly."
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ classifiers =
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
license = New BSD
Expand Down
33 changes: 14 additions & 19 deletions tests/test_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@


# Some coroutines with known behavior for testing purposes.
@asyncio.coroutine
def do_stuff(results, x):
async def do_stuff(results, x):
for i in range(0, x):
results.append(i)
yield from asyncio.sleep(0.1)
await asyncio.sleep(0.1)


@asyncio.coroutine
def stop_loop(loop, delay):
yield from asyncio.sleep(delay)
async def stop_loop(loop, delay):
await asyncio.sleep(delay)
loop.stop()


Expand Down Expand Up @@ -123,14 +121,13 @@ def test_tcp_echo(self):

server_messages = []

@asyncio.coroutine
def echo_server(reader, writer):
data = yield from reader.read(100)
async def echo_server(reader, writer):
data = await reader.read(100)
message = data.decode()
server_messages.append(message)

writer.write(data)
yield from writer.drain()
await writer.drain()

writer.close()

Expand All @@ -140,13 +137,12 @@ def echo_server(reader, writer):

client_messages = []

@asyncio.coroutine
def echo_client(message):
reader, writer = yield from asyncio.open_connection('127.0.0.1', 3742)
async def echo_client(message):
reader, writer = await asyncio.open_connection('127.0.0.1', 3742)

writer.write(message.encode())

data = yield from reader.read(100)
data = await reader.read(100)
client_messages.append(data.decode())

writer.close()
Expand All @@ -168,18 +164,17 @@ def tearDown(self):
self.loop.close()

def test_subprocess(self):
@asyncio.coroutine
def list_dir():
proc = yield from asyncio.create_subprocess_shell(
async def list_dir():
proc = await asyncio.create_subprocess_shell(
'ls',
stdout=asyncio.subprocess.PIPE,
)

entries = set()
line = yield from proc.stdout.readline()
line = await proc.stdout.readline()
while line:
entries.add(line.decode('utf-8').strip())
line = yield from proc.stdout.readline()
line = await proc.stdout.readline()

# Cleanup - close the transport.
proc._transport.close()
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# and then run "tox" from this directory.

[tox]
envlist = flake8,towncrier-check,docs,package,py{35,36,37,38,39,310},pypy3
envlist = flake8,towncrier-check,docs,package,py{35,36,37,38,39,310,311},pypy3
skip_missing_interpreters = true

[testenv]
Expand Down