conftest.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. from __future__ import absolute_import
  2. import os
  3. import sys
  4. pytest_plugins = ["sentry.utils.pytest"]
  5. sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src"))
  6. def pytest_configure(config):
  7. import warnings
  8. # XXX(dcramer): Kombu throws a warning due to transaction.commit_manually
  9. # being used
  10. warnings.filterwarnings("error", "", Warning, r"^(?!(|kombu|raven|sentry))")
  11. # always install plugins for the tests
  12. install_sentry_plugins()
  13. config.addinivalue_line("markers", "obsolete: mark test as obsolete and soon to be removed")
  14. def install_sentry_plugins():
  15. # Sentry's pytest plugin explicitly doesn't load plugins, so let's load all of them
  16. # and ignore the fact that we're not *just* testing our own
  17. # Note: We could manually register/configure INSTALLED_APPS by traversing our entry points
  18. # or package directories, but this is easier assuming Sentry doesn't change APIs.
  19. # Note: Order of operations matters here.
  20. from sentry.runner.importer import install_plugin_apps
  21. from django.conf import settings
  22. install_plugin_apps("sentry.apps", settings)
  23. from sentry.runner.initializer import register_plugins
  24. register_plugins(settings, raise_on_plugin_load_failure=True)
  25. settings.ASANA_CLIENT_ID = "abc"
  26. settings.ASANA_CLIENT_SECRET = "123"
  27. settings.BITBUCKET_CONSUMER_KEY = "abc"
  28. settings.BITBUCKET_CONSUMER_SECRET = "123"
  29. settings.GITHUB_APP_ID = "abc"
  30. settings.GITHUB_API_SECRET = "123"
  31. # this isn't the real secret
  32. settings.SENTRY_OPTIONS["github.integration-hook-secret"] = "b3002c3e321d4b7880360d397db2ccfd"