Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/test_qeventloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@
import pytest

import qasync
from qasync import QtModuleName

# flags for skipping certain tests for PySide6
# This module has known issues causing crashes if certain
# combinations of tests are invoked, likely caused by some internal problems.
# current experimentation shows that it is sufficient to skip the socket pair
# tests and the event-loop-on-qthread tests to avoid crashes later on in the suite.
# Setting any one of these flags true reduces the frequency of crashes
# but does not eliminate them.
skip_process = False
skip_socket = True
skip_qthread = True


@pytest.fixture
Expand Down Expand Up @@ -65,6 +77,8 @@
)
def executor(request):
exc_cls = request.param
if exc_cls is ProcessPoolExecutor and QtModuleName == "PySide6" and skip_process:
pytest.skip("subprocess is unreliable for PySide6")

Check warning on line 81 in tests/test_qeventloop.py

View workflow job for this annotation

GitHub Actions / collect coverage

Missing coverage

Missing coverage on line 81
if exc_cls is None:
return None

Expand Down Expand Up @@ -130,6 +144,7 @@
logging.debug("start blocking task()")


@pytest.mark.skipif(QtModuleName == "PySide6" and skip_process, reason="subprocess is unreliable on PySide6")
def test_can_execute_subprocess(loop):
"""Verify that a subprocess can be executed."""

Expand All @@ -143,6 +158,7 @@
loop.run_until_complete(asyncio.wait_for(mycoro(), timeout=10.0))


@pytest.mark.skipif(QtModuleName == "PySide6" and skip_process, reason="subprocess is unreliable on PySide6")
def test_can_read_subprocess(loop):
"""Verify that a subprocess's data can be read from stdout."""

Expand All @@ -163,6 +179,7 @@
loop.run_until_complete(asyncio.wait_for(mycoro(), timeout=10.0))


@pytest.mark.skipif(QtModuleName == "PySide6" and skip_process, reason="subprocess is unreliable on PySide6")
def test_can_communicate_subprocess(loop):
"""Verify that a subprocess's data can be passed in/out via stdin/stdout."""

Expand All @@ -184,6 +201,7 @@
loop.run_until_complete(asyncio.wait_for(mycoro(), timeout=10.0))


@pytest.mark.skipif(QtModuleName == "PySide6" and skip_process, reason="subprocess is unreliable on PySide6")
def test_can_terminate_subprocess(loop):
"""Verify that a subprocess can be terminated."""

Expand Down Expand Up @@ -309,6 +327,8 @@

If socket.socketpair isn't available, we emulate it.
"""
if QtModuleName == "PySide6" and skip_socket:
pytest.skip("SocketPairs are unreliable on PySide6")

def fin():
if client_sock is not None:
Expand Down Expand Up @@ -887,6 +907,7 @@
application.exec_ = orig_exec


@pytest.mark.skipif(QtModuleName == "PySide6" and skip_qthread, reason="unreliable on PySide6")
def test_qeventloop_in_qthread():
class CoroutineExecutorThread(qasync.QtCore.QThread):
def __init__(self, coro):
Expand Down
Loading