Tests fail on tornado 5.x
Arch Linux is currently trying to update to python 3.7.0, and while rebuilding all packages in our repositories, raven failed the testsuite with the following log:
============================= test session starts ==============================
platform linux -- Python 3.7.0, pytest-3.6.3, py-1.5.4, pluggy-0.6.0
Django settings: tests.contrib.django.settings (from ini file)
rootdir: /build/python-raven/src/raven-python-6.9.0, inifile: setup.cfg
plugins: xdist-1.22.2, timeout-1.2.1, forked-0.2, django-3.3.2, cov-2.5.1, celery-4.2.1, case-1.5.3
collected 319 items / 1 skipped
tests/base/tests.py ................................................ [ 15%]
tests/breadcrumbs/tests.py .......... [ 18%]
tests/conf/tests.py ............... [ 22%]
tests/context/tests.py .... [ 24%]
tests/contrib/test_celery.py ..... [ 25%]
tests/contrib/bottle/tests.py ... [ 26%]
tests/contrib/django/test_resolver.py ..... [ 28%]
tests/contrib/django/tests.py .................s........s............... [ 41%]
................ [ 46%]
tests/contrib/django/management/commands/test_raven.py . [ 46%]
tests/contrib/flask/tests.py ............s..... [ 52%]
tests/contrib/pylons/tests.py . [ 52%]
tests/contrib/tornado/tests.py .........F [ 55%]
tests/contrib/zconfig/tests.py .. [ 56%]
tests/events/tests.py ..... [ 57%]
tests/functional/tests.py . [ 58%]
tests/handlers/logbook/tests.py ....... [ 60%]
tests/handlers/logging/tests.py ........................... [ 68%]
tests/middleware/tests.py ..... [ 70%]
tests/processors/tests.py ....................... [ 77%]
tests/transport/tests.py ... [ 78%]
tests/transport/requests/test_threaded_requests.py .. [ 79%]
tests/transport/requests/tests.py . [ 79%]
tests/transport/threaded/tests.py .... [ 80%]
tests/transport/tornado/tests.py F.F [ 81%]
tests/utils/test_conf.py . [ 82%]
tests/utils/test_imports.py . [ 82%]
tests/utils/test_transaction.py .. [ 83%]
tests/utils/tests.py .. [ 83%]
tests/utils/encoding/tests.py s.....s...s..s..s..ss.. [ 90%]
tests/utils/json/tests.py ....... [ 93%]
tests/utils/stacks/tests.py ..... [ 94%]
tests/utils/wsgi/tests.py ............... [ 99%]
tests/versioning/tests.py s. [100%]
=================================== FAILURES ===================================
TornadoAsyncClientTestCase.test_sending_to_unresponsive_sentry_server_logs_error
Traceback (most recent call last):
File "/build/python-raven/src/raven-python-6.9.0/tests/contrib/tornado/tests.py", line 231, in test_sending_to_unresponsive_sentry_server_logs_error
assert mock_failed.called
AssertionError: assert False
+ where False = <MagicMock name='_failed_send' id='140119395899824'>.called
___ TornadoTransportTests.test__sending_successfully_calls_success_callback ____
Traceback (most recent call last):
File "/build/python-raven/src/raven-python-6.9.0/tests/transport/tornado/tests.py", line 63, in test__sending_successfully_calls_success_callback
assert mock_successful.called
AssertionError: assert False
+ where False = <MagicMock name='_successful_send' id='140119393291568'>.called
----------------------------- Captured stderr call -----------------------------
Sentry responded with an error: type object 'IOLoop' has no attribute 'initialized' (url: http://localhost:46754/api/1/store/)
Traceback (most recent call last):
File "/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/base.py", line 733, in send_remote
failed_send)
File "/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/transport/tornado.py", line 40, in async_send
if ioloop.IOLoop.initialized():
AttributeError: type object 'IOLoop' has no attribute 'initialized'
['test']
_______________________ TornadoTransportTests.test_send ________________________
Traceback (most recent call last):
File "/build/python-raven/src/raven-python-6.9.0/tests/transport/tornado/tests.py", line 32, in test_send
fake_client.assert_called_once_with()
File "/usr/lib/python3.7/site-packages/mock/mock.py", line 947, in assert_called_once_with
raise AssertionError(msg)
AssertionError: Expected 'HTTPClient' to be called once. Called 0 times.
----------------------------- Captured stderr call -----------------------------
Sentry responded with an error: type object 'IOLoop' has no attribute 'initialized' (url: https://host:1234/api/1/store/)
Traceback (most recent call last):
File "/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/base.py", line 733, in send_remote
failed_send)
File "/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/transport/tornado.py", line 40, in async_send
if ioloop.IOLoop.initialized():
AttributeError: type object 'IOLoop' has no attribute 'initialized'
['test']
----------- coverage: platform linux, python 3.7.0-final-0 -----------
Name Stmts Miss Cover
---------------------------------------------------------------------------------------
raven/__init__.py 26 26 0%
raven/base.py 418 418 0%
raven/breadcrumbs.py 195 195 0%
raven/conf/__init__.py 14 14 0%
raven/conf/defaults.py 18 18 0%
raven/conf/remote.py 78 78 0%
raven/context.py 82 82 0%
raven/contrib/__init__.py 1 1 0%
raven/contrib/async.py 13 13 0%
raven/contrib/awslambda/__init__.py 64 64 0%
raven/contrib/bottle/__init__.py 44 44 0%
raven/contrib/bottle/utils.py 14 14 0%
raven/contrib/celery/__init__.py 50 50 0%
raven/contrib/django/__init__.py 3 3 0%
raven/contrib/django/apps.py 9 9 0%
raven/contrib/django/celery/__init__.py 17 17 0%
raven/contrib/django/celery/models.py 5 5 0%
raven/contrib/django/celery/tasks.py 2 2 0%
raven/contrib/django/client.py 194 194 0%
raven/contrib/django/handlers.py 14 14 0%
raven/contrib/django/logging.py 5 5 0%
raven/contrib/django/management/__init__.py 1 1 0%
raven/contrib/django/management/commands/__init__.py 1 1 0%
raven/contrib/django/management/commands/raven.py 33 33 0%
raven/contrib/django/middleware/__init__.py 62 62 0%
raven/contrib/django/middleware/wsgi.py 9 9 0%
raven/contrib/django/models.py 160 160 0%
raven/contrib/django/raven_compat/__init__.py 2 2 0%
raven/contrib/django/raven_compat/handlers.py 2 2 0%
raven/contrib/django/raven_compat/management/__init__.py 2 2 0%
raven/contrib/django/raven_compat/management/commands/__init__.py 2 2 0%
raven/contrib/django/raven_compat/management/commands/raven.py 2 2 0%
raven/contrib/django/raven_compat/middleware/__init__.py 2 2 0%
raven/contrib/django/raven_compat/middleware/wsgi.py 2 2 0%
raven/contrib/django/raven_compat/models.py 2 2 0%
raven/contrib/django/raven_compat/templatetags/__init__.py 2 2 0%
raven/contrib/django/raven_compat/templatetags/raven.py 2 2 0%
raven/contrib/django/resolver.py 57 57 0%
raven/contrib/django/serializers.py 39 39 0%
raven/contrib/django/templatetags/__init__.py 1 1 0%
raven/contrib/django/templatetags/raven.py 7 7 0%
raven/contrib/django/urls.py 7 7 0%
raven/contrib/django/utils.py 59 59 0%
raven/contrib/django/views.py 64 64 0%
raven/contrib/flask.py 178 178 0%
raven/contrib/paste.py 6 6 0%
raven/contrib/pylons/__init__.py 12 12 0%
raven/contrib/sanic.py 110 110 0%
raven/contrib/tornado/__init__.py 89 89 0%
raven/contrib/webpy/__init__.py 33 33 0%
raven/contrib/webpy/utils.py 5 5 0%
raven/contrib/zconfig/__init__.py 13 13 0%
raven/contrib/zerorpc/__init__.py 18 18 0%
raven/contrib/zope/__init__.py 68 68 0%
raven/events.py 75 75 0%
raven/exceptions.py 18 18 0%
raven/handlers/__init__.py 1 1 0%
raven/handlers/logbook.py 53 53 0%
raven/handlers/logging.py 111 111 0%
raven/middleware.py 61 61 0%
raven/processors.py 99 99 0%
raven/scripts/__init__.py 1 1 0%
raven/scripts/runner.py 68 68 0%
raven/transport/__init__.py 11 11 0%
raven/transport/base.py 11 11 0%
raven/transport/eventlet.py 30 30 0%
raven/transport/exceptions.py 3 3 0%
raven/transport/gevent.py 27 27 0%
raven/transport/http.py 33 33 0%
raven/transport/registry.py 39 39 0%
raven/transport/requests.py 17 17 0%
raven/transport/threaded.py 104 104 0%
raven/transport/threaded_requests.py 18 18 0%
raven/transport/tornado.py 38 38 0%
raven/transport/twisted.py 32 32 0%
raven/utils/__init__.py 67 67 0%
raven/utils/basic.py 64 64 0%
raven/utils/compat.py 120 120 0%
raven/utils/conf.py 38 38 0%
raven/utils/encoding.py 47 47 0%
raven/utils/http.py 37 37 0%
raven/utils/imports.py 10 10 0%
raven/utils/json.py 63 63 0%
raven/utils/serializer/__init__.py 3 3 0%
raven/utils/serializer/base.py 115 115 0%
raven/utils/serializer/manager.py 55 55 0%
raven/utils/ssl_match_hostname.py 47 47 0%
raven/utils/stacks.py 159 159 0%
raven/utils/testutils.py 17 17 0%
raven/utils/transaction.py 36 36 0%
raven/utils/urlparse.py 12 12 0%
raven/utils/wsgi.py 46 46 0%
raven/versioning.py 42 42 0%
---------------------------------------------------------------------------------------
TOTAL 4146 4146 0%
=============================== warnings summary ===============================
tests/base/tests.py::ClientTest::test_client_picks_up_env_dsn
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/base/tests.py::ClientTest::test_raise_exception_on_send_error
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/base/tests.py::ClientTest::test_send_remote_failover
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/base/tests.py::ClientTest::test_send_remote_failover_with_retry_after
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/base/tests.py::ClientTest::test_transport_registration
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/conf/tests.py::RemoteConfigTest::test_invalid_scheme
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/contrib/django/tests.py::DjangoClientTest::test_get_user_info_is_authenticated_property
/usr/lib/python3.7/site-packages/django/db/models/base.py:309: RuntimeWarning: Model 'django.myuser' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
tests/contrib/django/tests.py::CeleryIsolatedClientTest::test_send_encoded
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/contrib/django/tests.py::CeleryIsolatedClientTest::test_without_eager
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/handlers/logging/tests.py::LoggingIntegrationTest::test_exception_on_emit
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/transport/tests.py::TransportTest::test_basic_config
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/transport/tests.py::TransportTest::test_build_then_send
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/transport/tests.py::TransportTest::test_custom_transport
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/transport/requests/test_threaded_requests.py::ThreadedTransportTest::test_does_send
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/transport/requests/test_threaded_requests.py::ThreadedTransportTest::test_shutdown_waits_for_send
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/transport/requests/tests.py::RequestsTransportTest::test_does_send
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/transport/threaded/tests.py::ThreadedTransportTest::test_does_send
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/transport/threaded/tests.py::ThreadedTransportTest::test_fork_spawns_anew
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/transport/threaded/tests.py::ThreadedTransportTest::test_fork_with_active_worker
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/transport/threaded/tests.py::ThreadedTransportTest::test_shutdown_waits_for_send
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/transport/tornado/tests.py::TornadoTransportTests::test__sending_successfully_calls_success_callback
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/transport/tornado/tests.py::TornadoTransportTests::test__sending_with_error_calls_error_callback
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
tests/transport/tornado/tests.py::TornadoTransportTests::test_send
/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/conf/remote.py:91: UserWarning: Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.
warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.')
-- Docs: http://doc.pytest.org/en/latest/warnings.html
======== 3 failed, 305 passed, 12 skipped, 23 warnings in 43.23 seconds ========
The warnings are there on python 3.6 and python 3.7... the critical bit is:
=================================== FAILURES ===================================
TornadoAsyncClientTestCase.test_sending_to_unresponsive_sentry_server_logs_error
Traceback (most recent call last):
File "/build/python-raven/src/raven-python-6.9.0/tests/contrib/tornado/tests.py", line 231, in test_sending_to_unresponsive_sentry_server_logs_error
assert mock_failed.called
AssertionError: assert False
+ where False = <MagicMock name='_failed_send' id='140119395899824'>.called
___ TornadoTransportTests.test__sending_successfully_calls_success_callback ____
Traceback (most recent call last):
File "/build/python-raven/src/raven-python-6.9.0/tests/transport/tornado/tests.py", line 63, in test__sending_successfully_calls_success_callback
assert mock_successful.called
AssertionError: assert False
+ where False = <MagicMock name='_successful_send' id='140119393291568'>.called
----------------------------- Captured stderr call -----------------------------
Sentry responded with an error: type object 'IOLoop' has no attribute 'initialized' (url: http://localhost:46754/api/1/store/)
Traceback (most recent call last):
File "/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/base.py", line 733, in send_remote
failed_send)
File "/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/transport/tornado.py", line 40, in async_send
if ioloop.IOLoop.initialized():
AttributeError: type object 'IOLoop' has no attribute 'initialized'
['test']
_______________________ TornadoTransportTests.test_send ________________________
Traceback (most recent call last):
File "/build/python-raven/src/raven-python-6.9.0/tests/transport/tornado/tests.py", line 32, in test_send
fake_client.assert_called_once_with()
File "/usr/lib/python3.7/site-packages/mock/mock.py", line 947, in assert_called_once_with
raise AssertionError(msg)
AssertionError: Expected 'HTTPClient' to be called once. Called 0 times.
----------------------------- Captured stderr call -----------------------------
Sentry responded with an error: type object 'IOLoop' has no attribute 'initialized' (url: https://host:1234/api/1/store/)
Traceback (most recent call last):
File "/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/base.py", line 733, in send_remote
failed_send)
File "/build/python-raven/src/raven-python-6.9.0/tmp_install/usr/lib/python3.7/site-packages/raven/transport/tornado.py", line 40, in async_send
if ioloop.IOLoop.initialized():
AttributeError: type object 'IOLoop' has no attribute 'initialized'
['test']
While raven declares 3.7 support in setup.py it doesn't to be tested against it - there is no mention of 3.7 in tox.ini nor .travis.yml .
The best way to resolve this issue is by including them in testing suite so it doesn't repeat in the future.
@eli-schwartz to be clear, this issue is fixed on your end, right? I can't reproduce any test failures with 3.7.
Actually the tests do still fail. But it's not a python3.7 error, it's a tornado 5.x error. I can pass the testsuite by removing the check dependency on tornado, and running pip install --root="$PWD/tmp_install" tornado==4.5.3 in our testsuite runner.
My bad for the false diagnosis. We updated to tornado 5.x in parallel with python 3.7, so running the tests in the non-staging repos used tornado 4.5.3 and python 3.6, while running the tests in the staging repos used tornado 5.x and python 3.7.
Reopening since it's about tornado now