diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 57a6a11..a0511af 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,7 @@ on: - develop pull_request: branches: - - '**' + - "**" concurrency: group: tests-${{ github.head_ref || github.ref }} @@ -15,7 +15,7 @@ concurrency: jobs: tests: - name: ${{ matrix.os }} / ${{ matrix.python-version }} + name: ${{ matrix.os }} / ${{ matrix.python-version }} / ${{ matrix.qt-version }} runs-on: ${{ matrix.image }} strategy: matrix: @@ -24,11 +24,11 @@ jobs: qt-version: ["pyside2", "pyside6", "pyqt5", "pyqt6"] include: - os: Ubuntu - image: ubuntu-20.04 + image: ubuntu-24.04 - os: Windows image: windows-2022 - os: MacOS - image: macos-12 + image: macos-14 fail-fast: false defaults: run: @@ -49,7 +49,7 @@ jobs: - name: Bootstrap poetry run: | - curl -sSL https://install.python-poetry.org | python - -y + curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.4 python - -y - name: Update Path if: ${{ matrix.os != 'Windows' }} @@ -100,7 +100,7 @@ jobs: DEBIAN_FRONTEND: noninteractive run: | sudo apt-get -qq update - sudo apt-get -qq install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev + sudo apt-get -qq install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev libegl-dev - name: Run pytest uses: coactions/setup-xvfb@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a948904..2eda3f3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Release on: push: tags: - - '*.*.*' + - "*.*.*" jobs: release: @@ -20,7 +20,7 @@ jobs: - name: Install Poetry run: | - curl -sSL https://install.python-poetry.org | python - -y + curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.4 python - -y - name: Update PATH run: echo "$HOME/.local/bin" >> $GITHUB_PATH diff --git a/pyproject.toml b/pyproject.toml index e134610..af8ba85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [tool.poetry] name = "qasync" -version = "0.27.1" +version = "0.27.2" description = "Python library for using asyncio in Qt-based applications" authors = [ - "Arve Knudsen ", - "Gerard Marull-Paretas ", - "Mark Harviston ", - "Sam McCormack", + "Arve Knudsen ", + "Gerard Marull-Paretas ", + "Mark Harviston ", + "Sam McCormack", ] maintainers = ["Alex March "] license = "BSD-2-Clause" @@ -15,13 +15,13 @@ homepage = "https://github.com/CabbageDevelopment/qasync" repository = "https://github.com/CabbageDevelopment/qasync" keywords = ["Qt", "asncio"] classifiers = [ - "Development Status :: 4 - Beta", - "Environment :: X11 Applications :: Qt", - "Intended Audience :: Developers", - "Operating System :: MacOS", - "Operating System :: Microsoft", - "Operating System :: POSIX", - "Topic :: Software Development :: Libraries :: Python Modules", + "Development Status :: 4 - Beta", + "Environment :: X11 Applications :: Qt", + "Intended Audience :: Developers", + "Operating System :: MacOS", + "Operating System :: Microsoft", + "Operating System :: POSIX", + "Topic :: Software Development :: Libraries :: Python Modules", ] [tool.poetry.dependencies] diff --git a/qasync/__init__.py b/qasync/__init__.py index 3363e97..ef9264b 100644 --- a/qasync/__init__.py +++ b/qasync/__init__.py @@ -342,7 +342,9 @@ def __init__(self, app=None, set_running_loop=False, already_running=False): self.__call_soon_signaller = signaller = _make_signaller(QtCore, object, tuple) self.__call_soon_signal = signaller.signal - signaller.signal.connect(lambda callback, args: self.call_soon(callback, *args)) + self.__call_soon_signal.connect( + lambda callback, args: self.call_soon(callback, *args) + ) assert self.__app is not None super().__init__() @@ -438,6 +440,9 @@ def close(self): if self.__default_executor is not None: self.__default_executor.shutdown() + if self.__call_soon_signal: + self.__call_soon_signal.disconnect() + super().close() self._timer.stop() @@ -524,6 +529,7 @@ def _remove_reader(self, fd): return False else: notifier.setEnabled(False) + notifier.activated["int"].disconnect() return True def _add_writer(self, fd, callback, *args): @@ -564,6 +570,7 @@ def _remove_writer(self, fd): return False else: notifier.setEnabled(False) + notifier.activated["int"].disconnect() return True def __notifier_cb_wrapper(self, notifiers, notifier, fd, callback, args): @@ -579,8 +586,6 @@ def __notifier_cb_wrapper(self, notifiers, notifier, fd, callback, args): # callback. We must not re-enable it in that case. if notifiers.get(fd, None) is notifier: notifier.setEnabled(True) - else: - notifier.activated["int"].disconnect() def __on_notifier_ready(self, notifiers, notifier, fd, callback, args): if fd not in notifiers: diff --git a/tests/test_qeventloop.py b/tests/test_qeventloop.py index 68ba88b..14bc6c1 100644 --- a/tests/test_qeventloop.py +++ b/tests/test_qeventloop.py @@ -4,19 +4,19 @@ # BSD License import asyncio -import logging -import sys -import os import ctypes +import logging import multiprocessing -from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor +import os import socket import subprocess - -import qasync +import sys +from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor import pytest +import qasync + @pytest.fixture def loop(request, application):