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

#11987 Run GI reactor tests on Windows #11988

Draft
wants to merge 10 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 24 additions & 1 deletion .github/workflows/test.yaml
Expand Up @@ -171,6 +171,16 @@ jobs:
# select a reactor.
trial-args: '--reactor=select'

# Windows, newest Python supported version with gi reactor.
# This needs a python version supported by Deluge GTK distribution.
- python-version: '3.10'
runs-on: 'windows-2022'
tox-env: 'alldeps-withcov-winghagi-windows'
job-name: 'win-default-tests-gi'
# Distributed trial is not yet suported on Windows.
# TOOO; set selector to gi once GI support is available.
trial-args: '--reactor=select'

# Windows, newest Python supported version with iocp reactor.
- python-version: '3.12'
runs-on: 'windows-2022'
Expand Down Expand Up @@ -247,7 +257,7 @@ jobs:

# Make sure the matrix is defined in such a way that this is triggered
# only on Linux.
- name: Install GTK system deps
- name: Install GTK system deps on Linux
if: matrix.platform-deps == 'gtk-platform'
run: |
# *-dev dependencies are for pygobject
Expand All @@ -261,6 +271,19 @@ jobs:
gir1.2-gtk-3.0 \
xvfb

# Make sure the matrix is defined in such a way that this is triggered
# only on Linux.
- name: Install GTK system deps on windows
if: matrix.tox-env == 'alldeps-withcov-winghagi-windows'
shell: pwsh
run: |
$WebClient = New-Object System.Net.WebClient
$WebClient.DownloadFile("https://github.com/deluge-torrent/gvsbuild-release/releases/download/latest/gvsbuild-py3.10-vs16-x64.zip","C:\GTK.zip")
7z x C:\GTK.zip -oc:\GTK
echo "C:\GTK\release\lib" | Out-File -FilePath $env:GITHUB_PATH -Append
echo "C:\GTK\release\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
echo "C:\GTK\release" | Out-File -FilePath $env:GITHUB_PATH -Append

- name: Test
run: |
${{ matrix.tox-wrapper }} tox ${{ matrix.trial-target }}
Expand Down
14 changes: 10 additions & 4 deletions src/twisted/internet/_signals.py
Expand Up @@ -49,9 +49,15 @@
from twisted.internet.interfaces import IReadDescriptor
from twisted.python import failure, log, util
from twisted.python.runtime import platformType
from . import fdesc

if platformType == "posix":
from . import fdesc, process
from .process import reapAllProcesses
else:

def reapAllProcesses() -> None:

Check warning on line 58 in src/twisted/internet/_signals.py

View check run for this annotation

Codecov / codecov/patch

src/twisted/internet/_signals.py#L58

Added line #L58 was not covered by tests
"Do nothing on Windows."


SignalHandler: TypeAlias = Callable[[int, Optional[FrameType]], None]

Expand Down Expand Up @@ -232,7 +238,7 @@
# This should only happen if someone used spawnProcess
# before calling reactor.run (and the process also exited
# already).
process.reapAllProcesses()
reapAllProcesses()

def uninstall(self) -> None:
"""
Expand Down Expand Up @@ -411,7 +417,7 @@
if platformType == "posix":
_Waker = _UnixWaker
else:
# Primarily Windows and Jython.
# Windows, and possibly other platforms without signals support
_Waker = _SocketWaker # type: ignore[misc,assignment]


Expand Down Expand Up @@ -442,4 +448,4 @@
method.
"""
super().doRead()
process.reapAllProcesses()
reapAllProcesses()
1 change: 1 addition & 0 deletions src/twisted/newsfragments/11987.bugfix
@@ -0,0 +1 @@
gi and gtk reactors now work again on Windows.
3 changes: 3 additions & 0 deletions tox.ini
Expand Up @@ -120,6 +120,9 @@ commands =

posix: python -c "print('Running on POSIX (no special dependencies)')"

; Install based on the the local GTK based on GitHub Actions and Deluge.
winghagi: python -m pip install --no-index --find-links="C:\GTK\release\python" PyGObject

; Run tests without wrapping them using coverage.
nocov: python -m twisted.trial --temp-directory={envtmpdir}/_trial_temp --reporter={env:TRIAL_REPORTER:verbose} {env:TRIAL_ARGS:-j8} {posargs:twisted}

Expand Down