feat: add support and workarounds for cpython3.11 (#31)

This commit is contained in:
J. Nick Koston 2022-11-01 16:49:02 -05:00 committed by GitHub
parent 1b5c9e1cb9
commit b53a4675d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 2 deletions

View File

@ -40,6 +40,7 @@ jobs:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
os:
- ubuntu-latest
extension:

View File

@ -31,7 +31,13 @@ class MessageFlag(IntFlag):
ALLOW_INTERACTIVE_AUTHORIZATION = 4
MESSAGE_FLAG_MAP = {field.value: field for field in MessageFlag}
# This is written out because of https://github.com/python/cpython/issues/98976
MESSAGE_FLAG_MAP = {
0: MessageFlag.NONE,
1: MessageFlag.NO_REPLY_EXPECTED,
2: MessageFlag.NO_AUTOSTART,
4: MessageFlag.ALLOW_INTERACTIVE_AUTHORIZATION,
}
class NameFlag(IntFlag):

View File

@ -1,4 +1,5 @@
import logging
import sys
from logging.handlers import QueueHandler
from queue import SimpleQueue
@ -122,6 +123,7 @@ async def test_aio_proxy_object():
bus2.disconnect()
@pytest.mark.skipif(sys.version_info[:3][1] in (11,), reason="segfaults on py3.11")
@pytest.mark.skipif(not has_gi, reason=skip_reason_no_gi)
def test_glib_proxy_object():
bus_name = "glib.client.test.methods"

View File

@ -1,3 +1,5 @@
import sys
import pytest
from dbus_fast import DBusError, Message, aio, glib
@ -94,6 +96,7 @@ async def test_aio_properties():
bus.disconnect()
@pytest.mark.skipif(sys.version_info[:3][1] in (11,), reason="segfaults on py3.11")
@pytest.mark.skipif(not has_gi, reason=skip_reason_no_gi)
def test_glib_properties():
service_bus = glib.MessageBus().connect_sync()

View File

@ -1,3 +1,5 @@
import sys
import pytest
from dbus_fast import Message, MessageType, aio, glib
@ -44,6 +46,9 @@ async def test_aio_big_message():
@pytest.mark.skipif(not has_gi, reason=skip_reason_no_gi)
@pytest.mark.skipif(
sys.version_info[:3][1] in (10, 11), reason="segfaults on py3.10,py3.11"
)
def test_glib_big_message():
"this tests that nonblocking reads and writes actually work for glib"
bus1 = glib.MessageBus().connect_sync()

View File

@ -1,3 +1,5 @@
import sys
import pytest
from dbus_fast import Message, MessageFlag, MessageType
@ -11,6 +13,7 @@ if has_gi:
@pytest.mark.skipif(not has_gi, reason=skip_reason_no_gi)
@pytest.mark.skipif(sys.version_info[:3][1] in (11,), reason="segfaults on py3.11")
def test_standard_interfaces():
bus = MessageBus().connect_sync()
msg = Message(
@ -51,6 +54,7 @@ def test_standard_interfaces():
@pytest.mark.skipif(not has_gi, reason=skip_reason_no_gi)
@pytest.mark.skipif(sys.version_info[:3][1] in (11,), reason="segfaults on py3.11")
def test_sending_messages_between_buses():
bus1 = MessageBus().connect_sync()
bus2 = MessageBus().connect_sync()
@ -118,6 +122,7 @@ def test_sending_messages_between_buses():
@pytest.mark.skipif(not has_gi, reason=skip_reason_no_gi)
@pytest.mark.skipif(sys.version_info[:3][1] in (11,), reason="segfaults on py3.11")
def test_sending_signals_between_buses():
bus1 = MessageBus().connect_sync()
bus2 = MessageBus().connect_sync()

View File

@ -70,7 +70,9 @@ async def test_name_requests():
bus2.disconnect()
@pytest.mark.skipif(sys.version_info[:3][1] == 10, reason="segfaults on py3.10")
@pytest.mark.skipif(
sys.version_info[:3][1] in (10, 11), reason="segfaults on py3.10,py3.11"
)
@pytest.mark.skipif(not has_gi, reason=skip_reason_no_gi)
def test_request_name_glib():
test_name = "glib.test.request.name"