|
24 | 24 | add_global_event_processor, |
25 | 25 | global_event_processors, |
26 | 26 | ) |
| 27 | +from sentry_sdk.utils import get_sdk_name |
27 | 28 |
|
28 | 29 |
|
29 | 30 | def test_processors(sentry_init, capture_events): |
@@ -437,3 +438,69 @@ def foo(event, hint): |
437 | 438 | assert reports == [("event_processor", "error"), ("event_processor", "transaction")] |
438 | 439 |
|
439 | 440 | global_event_processors.pop() |
| 441 | + |
| 442 | + |
| 443 | +@pytest.mark.parametrize( |
| 444 | + "installed_integrations, expected_name", |
| 445 | + [ |
| 446 | + # integrations with own name |
| 447 | + (["django"], "sentry.python.django"), |
| 448 | + (["flask"], "sentry.python.flask"), |
| 449 | + (["fastapi"], "sentry.python.fastapi"), |
| 450 | + (["bottle"], "sentry.python.bottle"), |
| 451 | + (["falcon"], "sentry.python.falcon"), |
| 452 | + (["quart"], "sentry.python.quart"), |
| 453 | + (["sanic"], "sentry.python.sanic"), |
| 454 | + (["starlette"], "sentry.python.starlette"), |
| 455 | + (["chalice"], "sentry.python.chalice"), |
| 456 | + (["serverless"], "sentry.python.serverless"), |
| 457 | + (["pyramid"], "sentry.python.pyramid"), |
| 458 | + (["tornado"], "sentry.python.tornado"), |
| 459 | + (["aiohttp"], "sentry.python.aiohttp"), |
| 460 | + (["aws_lambda"], "sentry.python.aws_lambda"), |
| 461 | + (["gcp"], "sentry.python.gcp"), |
| 462 | + (["beam"], "sentry.python.beam"), |
| 463 | + (["asgi"], "sentry.python.asgi"), |
| 464 | + (["wsgi"], "sentry.python.wsgi"), |
| 465 | + # integrations without name |
| 466 | + (["argv"], "sentry.python"), |
| 467 | + (["atexit"], "sentry.python"), |
| 468 | + (["boto3"], "sentry.python"), |
| 469 | + (["celery"], "sentry.python"), |
| 470 | + (["dedupe"], "sentry.python"), |
| 471 | + (["excepthook"], "sentry.python"), |
| 472 | + (["executing"], "sentry.python"), |
| 473 | + (["modules"], "sentry.python"), |
| 474 | + (["pure_eval"], "sentry.python"), |
| 475 | + (["redis"], "sentry.python"), |
| 476 | + (["rq"], "sentry.python"), |
| 477 | + (["sqlalchemy"], "sentry.python"), |
| 478 | + (["stdlib"], "sentry.python"), |
| 479 | + (["threading"], "sentry.python"), |
| 480 | + (["trytond"], "sentry.python"), |
| 481 | + (["logging"], "sentry.python"), |
| 482 | + (["gnu_backtrace"], "sentry.python"), |
| 483 | + (["httpx"], "sentry.python"), |
| 484 | + # precedence of frameworks |
| 485 | + (["flask", "django", "celery"], "sentry.python.django"), |
| 486 | + (["fastapi", "flask", "redis"], "sentry.python.flask"), |
| 487 | + (["bottle", "fastapi", "httpx"], "sentry.python.fastapi"), |
| 488 | + (["falcon", "bottle", "logging"], "sentry.python.bottle"), |
| 489 | + (["quart", "falcon", "gnu_backtrace"], "sentry.python.falcon"), |
| 490 | + (["sanic", "quart", "sqlalchemy"], "sentry.python.quart"), |
| 491 | + (["starlette", "sanic", "rq"], "sentry.python.sanic"), |
| 492 | + (["chalice", "starlette", "modules"], "sentry.python.starlette"), |
| 493 | + (["serverless", "chalice", "pure_eval"], "sentry.python.chalice"), |
| 494 | + (["pyramid", "serverless", "modules"], "sentry.python.serverless"), |
| 495 | + (["tornado", "pyramid", "executing"], "sentry.python.pyramid"), |
| 496 | + (["aiohttp", "tornado", "dedupe"], "sentry.python.tornado"), |
| 497 | + (["aws_lambda", "aiohttp", "boto3"], "sentry.python.aiohttp"), |
| 498 | + (["gcp", "aws_lambda", "atexit"], "sentry.python.aws_lambda"), |
| 499 | + (["beam", "gcp", "argv"], "sentry.python.gcp"), |
| 500 | + (["asgi", "beam", "stdtlib"], "sentry.python.beam"), |
| 501 | + (["wsgi", "asgi", "boto3"], "sentry.python.asgi"), |
| 502 | + (["wsgi", "celery", "redis"], "sentry.python.wsgi"), |
| 503 | + ], |
| 504 | +) |
| 505 | +def test_get_sdk_name(installed_integrations, expected_name): |
| 506 | + assert get_sdk_name(installed_integrations) == expected_name |
0 commit comments