You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DeprecationWarning: reactor.iterate cannot be used inside unit tests. In the future, using iterate will fail the test and may crash or hang the test run.
#43
Open
altendky opened this issue
May 20, 2020
· 2 comments
============================= test session starts ==============================
platform linux -- Python 3.6.10, pytest-5.4.2, py-1.8.1, pluggy-0.13.1 -- /__w/pytest-twisted/pytest-twisted/.tox/py36-qt5reactor/bin/python
cachedir: .pytest_cache
PyQt5 5.14.2 -- Qt runtime 5.14.2 -- Qt compiled 5.14.2
rootdir: /tmp/pytest-of-root/pytest-0/test_scrapy____something0
plugins: qt-3.3.0, xvfb-1.2.0, twisted-1.12
collecting ... collected 1 item
test_scrapy____something.py::Test::test PASSED [100%]
=============================== warnings summary ===============================
test_scrapy____something.py::Test::test
/__w/pytest-twisted/pytest-twisted/.tox/py36-qt5reactor/lib/python3.6/site-packages/qt5reactor/core.py:292: DeprecationWarning: reactor.iterate cannot be used inside unit tests. In the future, using iterate will fail the test and may crash or hang the test run.
self.iterate(delay=delay, fromqt=True)
-- Docs: https://docs.pytest.org/en/latest/warnings.html
========================= 1 passed, 1 warning in 0.10s =========================
def_makeReactorMethod(self, name):
""" Create a method which wraps the reactor method C{name}. The new method issues a deprecation warning and calls the original. """def_(*a, **kw):
warnings.warn("reactor.%s cannot be used inside unit tests. ""In the future, using %s will fail the test and may ""crash or hang the test run."% (name, name),
stacklevel=2, category=DeprecationWarning)
returnself._reactorMethods[name](*a, **kw)
return_
This was noticed over in pytest-dev/pytest-twisted#94 (for pytest-dev/pytest-twisted#93) after pytest 5.4.2 fixed (or hid or...) the other issue that related to test teardown and re-entering the reactor. I don't know if this is ... a sign of an additional pytest issue? a false alarm where this is just 'misdetected' as 'inside unit tests'? or a real qt5reactor issue.
https://github.com/pytest-dev/pytest-twisted/pull/94/checks?check_run_id=692810777
https://github.com/sunu/qt5reactor/blob/8aaf354ef5d5ec07aca4fbe3c4ec9fba2c476ee9/src/qt5reactor/core.py#L291-L292
The text was updated successfully, but these errors were encountered: