Skip to content

Commit 6823f4e

Browse files
authored
Merge pull request #109 from altendky/drop_qt5reactor_workaround
Shift workaround to qt5reactor
2 parents 37693ec + 7808595 commit 6823f4e

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

pytest_twisted.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
import greenlet
88
import pytest
99

10-
from twisted.internet import defer
11-
# from twisted.internet import error
10+
from twisted.internet import defer, error
1211
from twisted.internet.threads import blockingCallFromThread
1312
from twisted.python import failure
1413

@@ -401,14 +400,9 @@ def init_asyncio_reactor():
401400

402401
def _install_reactor(reactor_installer, reactor_type):
403402
"""Install the specified reactor and create the greenlet."""
404-
# TODO: maybe fix this in qt5reactor? btw, it avoids creating a second
405-
# qt5reactor.core.QtEventReactor and this somehow fixes the hang
406-
# that showed up in 5.15.0.
407-
# try:
408-
if 'twisted.internet.reactor' not in sys.modules:
403+
try:
409404
reactor_installer()
410-
# except error.ReactorAlreadyInstalledError:
411-
else:
405+
except error.ReactorAlreadyInstalledError:
412406
import twisted.internet.reactor
413407

414408
if not isinstance(twisted.internet.reactor, reactor_type):

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
py_modules=["pytest_twisted"],
1616
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
1717
install_requires=["greenlet", "pytest>=2.3", "decorator"],
18-
extras_require={"dev": ["pre-commit", "black"]},
18+
extras_require={
19+
"dev": ["pre-commit", "black"],
20+
"pyside2": ["pyside2", "qt5reactor"],
21+
"pyqt5": ["pyqt5", "qt5reactor>=0.6.2"],
22+
},
1923
classifiers=[
2024
"Development Status :: 5 - Production/Stable",
2125
"Intended Audience :: Developers",

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ deps=
1515
qt5reactor: pytest-xvfb
1616
qt5reactor: pyqt5
1717
qt5reactor: pywin32; sys_platform == 'win32'
18+
extras=
19+
qt5reactor: pyqt5
1820
setenv=
1921
defaultreactor: REACTOR = default
2022
qt5reactor: REACTOR = qt5reactor

0 commit comments

Comments
 (0)