-
-
Notifications
You must be signed in to change notification settings - Fork 657
By default don't import 3rd-party Python modules, only stdlib ones. … #857
base: master
Are you sure you want to change the base?
Conversation
This will break a backwards compat change (where we let you configure the transport with the DSN), but as long as we mentioned that in the CHANGES I'm totally ok with it. We also should simply remove the comments and just kill the lines (we're using version control after all). |
So I fixed the tests and cleaned up the code. One issue that I had was that I have to access |
Thanks! I'm fine with renaming it to .registry as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(still getting used to the code review process)
CHANGES
Outdated
from raven.transport.threaded_requests import ThreadedRequestsHTTPTransport | ||
from raven.base import Client | ||
|
||
for transport in [EventletHTTPTransport, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of note we dont actually need to do this since you can pass transport to the Client() itself. It was purely for backwards compatibility for a period of time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the problem is that a typical Django setup just adds raven.contrib.django.raven_compat
to the list of INSTALLED_APPS. If they also have a weird DSN configured, they would need to register the transports in the registry for it to work, as the Django Sentry app creates its own Client() and I honestly have no idea how to customize creation of this Client()...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can actually just pass it into SENTRY_CONFIG via 'transport' (same as all of the other config options).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, OK then. I guess I can update the documentation to reflect this. Seems cleaner the way you suggest.
conftest.py
Outdated
|
||
|
||
|
||
for transport in [EventletHTTPTransport, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assuming things break without this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly yes. The reason is that all tests build clients based on DSN, so a few test cases fail. And I guess using the DSN and registry is part of the things we test, so we can't remove it?
_________________________________________________________________________________________________ ThreadedTransportTest.test_does_send __________________________________________________________________________________________________
InvalidDsn: Unsupported Sentry DSN scheme: threaded+requests+http (threaded+requests+http://some_username:some_password@localhost:8143/1)
__________________________________________________________________________________________ ThreadedTransportTest.test_shutdown_waits_for_send ___________________________________________________________________________________________
InvalidDsn: Unsupported Sentry DSN scheme: threaded+requests+http (threaded+requests+http://some_username:some_password@localhost:8143/1)
_________________________________________________________________________________________________ RequestsTransportTest.test_does_send __________________________________________________________________________________________________
InvalidDsn: Unsupported Sentry DSN scheme: requests+http (requests+http://some_username:some_password@localhost:8143/1)
________________________________________________________________________________ TornadoTransportTests.test__sending_successfully_calls_success_callback ________________________________________________________________________________
InvalidDsn: Unsupported Sentry DSN scheme: tornado+http (tornado+http://uver:pass@localhost:46754/1)
__________________________________________________________________________________ TornadoTransportTests.test__sending_with_error_calls_error_callback __________________________________________________________________________________
InvalidDsn: Unsupported Sentry DSN scheme: tornado+http (tornado+http://uver:pass@localhost:46754/1)
____________________________________________________________________________________________________ TornadoTransportTests.test_send ____________________________________________________________________________________________________
InvalidDsn: Unsupported Sentry DSN scheme: tornado+https (tornado+https://user:pass@host:1234/1?timeout=1&verify_ssl=1&ca_certs=/some/path/somefile)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we'd have to update these tests to pass it in directly, but I'd be ok with that in order to remove the legacy compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Will probably have to wait a few days before I commit more changes, as I'll be travelling today (to PyCon UK) and I don't have a laptop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I left comments but GitHub is broken.
Please check if the latest commits address your comments. |
Looks good we just need to update the tornado tests to remove the tornado+ prefix I think? |
Hm, some Tornado test failing on Python 2.6, but I don't know why :( |
2.6 is very much alive, we can't kill it yet. |
It's all very fine to say "we must support Python2.6", but you have to realise it is incredibly hard, today, to do anything with Python2.6. After much insistence, I managed to get a docker image with python2.6 and pip, but even then I didn't manage to run the tests. The latest error is:
Please, please, reconsider Python 2.6, it is dragging raven-python down! Maybe rebrand raven-python into a new major release and state in the release notes that whoever needs Python 2.6 support should continue using the old raven version? Oh, drat, I see now you had a major release recently :( There must be something we can do, this is ridiculous. How are we supposed to fix tests if can't even run them? |
…Fixes #854.
This change is