How to ignore expected errors coming from CI tests

I’m just discovering Sentry and didnt see in the documentation how to avoid getting errors reports from expected errors triggered in tests.

My app is running tests in gitlab CI and for some of them I have something like:

def test_toto():
with pytest.raises(ValueError):

def function_called_with_failing_params(param):
    except Exception as e:

Currently I have Sentry reporting me those errors each time I’m running tests, how can I avoid that ?

You should not configure Sentry to be enabled in your tests at all. Your DSN, while not totally secret, is production/staging config.

1 Like