-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sentry should ignore all error/exceptions when running unit tests. #30
Comments
As a hack, I just put in an invalid SENTRY_REMOTE_URL in my localsettings.py file:
That is enough to stop my development box from sending the errors in. |
I can easily do this within runtests.py, but not your own test suite. The problem is I can't determine whether you're running tests or not. |
Is there a way to remove Sentry from settings.INSTALLED_APPS during testing? The database creation dies while trying to run a migration. I tried the following at the top of my test suite:
but it looks like it runs too late, as South's migration manager still runs and complains there's no app named "Sentry". |
If there was a settings.py variable set to specify whether to send errors to Sentry, you could turn off sentry logging at the top of your tests.py file. Might be a little crude in that you could technically modify the settings once in any test.py file, but until there is a django test specific settings file, not too sure what else to do. We currently specify a separate test_settings.py file where we remove sentry (and related) from the INSTALLED_APPS. It works well enough for our Hudson instance, but is kind of a pain on your development box. |
I will add a toggle to flat out disable sentry (though it may just be specifying the client as dummy). What we do locally is have our settings.py remove sentry/sentry.client from INSTALLED_APPS. |
I'm happy to just do that rather than make you work around me. Can you just explain how you do that, since my code sample above isn't succeeding? Thanks. |
tclancy, wrote this up real quick: http://justcramer.com/2011/01/13/settings-in-django/ |
That's awesome, thanks so much. It's usually just me, so I get away with the local_settings.py file, but that's good stuff. |
Shouldn't this be closed? |
Yes, it should :) |
Totally lazy person's solution: rename/ delete/ move Sentry's /migrations folder. |
And 12 seconds later, an actual, mature fix for the problem I was having: SOUTH_TESTS_MIGRATE = False in your settings file. |
It is probably not beneficial to have sentry attempt to log errors when the test harness is running.
The text was updated successfully, but these errors were encountered: