pytest_plugin: Update sentry fixtures after sentry-python 2.0 release
sentry-python 2.0 introduced some breaking API changes so update the sentry fixtures used in tests to restore previous behavior.
This fixes the new errors reported in https://jenkins.softwareheritage.org/job/DENV/job/tests/205/.
I also added a commit to allow initializing sentry with a None
DSN for testing purposes,
it will also enable to remove the use of a fake DSN when initializing sentry for celery tasks (see code).
Merge request reports
Activity
Jenkins job DCORE/gitlab-builds #168 succeeded .
See Console Output and Coverage Report for more details.Looks good to me overall, thanks.
If the
init_sentry(sentry_dsn=None)
codepath is used in celery tasks, then the celery workers might print the new warning, but then the DSN will be overridden by the per-task dict and sentry events will be sent. It would be nicer if we could quiesce this warning (and be explicit about the fact that the DSN is left undefined).One option to do so would be to allow passing a "flag" object as
sentry_dsn
to theinit_sentry
function (e.g.DEFERRED_SETUP = object()
), and check ifsentry_dsn
is that sentinel object before printing the warning.I ended up by adding a new optional boolean parameter named
deferred_init
toinit_sentry
which is quite equivalent.Edited by Antoine Lambert
Jenkins job DCORE/gitlab-builds #169 succeeded .
See Console Output and Coverage Report for more details.