Skip to content

Commit

Permalink
Added support for PySide6 to the Qt scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Feb 9, 2022
1 parent 5a0caff commit c9f8c37
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
11 changes: 7 additions & 4 deletions apscheduler/schedulers/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
from PyQt4.QtCore import QObject, QTimer
except ImportError:
try:
from PySide2.QtCore import QObject, QTimer # noqa
from PySide6.QtCore import QObject, QTimer # noqa
except ImportError:
try:
from PySide.QtCore import QObject, QTimer # noqa
from PySide2.QtCore import QObject, QTimer # noqa
except ImportError:
raise ImportError('QtScheduler requires either PyQt5, PyQt4, PySide2 '
'or PySide installed')
try:
from PySide.QtCore import QObject, QTimer # noqa
except ImportError:
raise ImportError('QtScheduler requires either PyQt5, PyQt4, PySide6, PySide2 '
'or PySide installed')


class QtScheduler(BaseScheduler):
Expand Down
1 change: 1 addition & 0 deletions docs/versionhistory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ APScheduler, see the :doc:`migration section <migration>`.
UNRELEASED
----------

* Added support for PySide6 to the Qt scheduler
* No longer enforce pytz time zones (support for others is experimental in the 3.x series)
* Fixed compatibility with PyMongo 4
* Fixed pytz deprecation warnings
Expand Down
5 changes: 2 additions & 3 deletions tests/test_schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,11 +1039,10 @@ def start_scheduler(self, request, reactor, scheduler):
thread.join()


@pytest.mark.skip
class TestQtScheduler(SchedulerImplementationTestBase):
@pytest.fixture(scope='class')
def coreapp(self):
QtCore = pytest.importorskip('PySide.QtCore')
QtCore = pytest.importorskip('PySide6.QtCore')
QtCore.QCoreApplication([])

@pytest.fixture
Expand All @@ -1052,7 +1051,7 @@ def scheduler(self, coreapp):
return qt.QtScheduler()

def wait_event(self, queue):
from PySide.QtCore import QCoreApplication
from PySide6.QtCore import QCoreApplication

while queue.empty():
QCoreApplication.processEvents()
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ extras = testing
tornado
twisted
zookeeper
deps = {py35,py36,py37}: PyQt5
deps =
{py35}: PyQt5
{py36,py37,py38,py39,py310}: PySide6

[testenv:py34]
deps = twisted < 19.7
Expand Down

0 comments on commit c9f8c37

Please sign in to comment.