|
| 1 | +import inspect |
1 | 2 | from unittest import mock
|
2 | 3 |
|
3 | 4 | import pytest
|
4 | 5 |
|
| 6 | +from sentry_sdk.tracing import trace |
5 | 7 | from sentry_sdk.tracing_utils import start_child_span_decorator
|
6 | 8 | from sentry_sdk.utils import logger
|
7 | 9 | from tests.conftest import patch_start_tracing_child
|
@@ -76,3 +78,38 @@ async def test_trace_decorator_async_no_trx():
|
76 | 78 | "test_decorator.my_async_example_function",
|
77 | 79 | )
|
78 | 80 | assert result2 == "return_of_async_function"
|
| 81 | + |
| 82 | + |
| 83 | +def test_functions_to_trace_signature_unchanged_sync(sentry_init): |
| 84 | + sentry_init( |
| 85 | + traces_sample_rate=1.0, |
| 86 | + ) |
| 87 | + |
| 88 | + def _some_function(a, b, c): |
| 89 | + pass |
| 90 | + |
| 91 | + @trace |
| 92 | + def _some_function_traced(a, b, c): |
| 93 | + pass |
| 94 | + |
| 95 | + assert inspect.getcallargs(_some_function, 1, 2, 3) == inspect.getcallargs( |
| 96 | + _some_function_traced, 1, 2, 3 |
| 97 | + ) |
| 98 | + |
| 99 | + |
| 100 | +@pytest.mark.asyncio |
| 101 | +async def test_functions_to_trace_signature_unchanged_async(sentry_init): |
| 102 | + sentry_init( |
| 103 | + traces_sample_rate=1.0, |
| 104 | + ) |
| 105 | + |
| 106 | + async def _some_function(a, b, c): |
| 107 | + pass |
| 108 | + |
| 109 | + @trace |
| 110 | + async def _some_function_traced(a, b, c): |
| 111 | + pass |
| 112 | + |
| 113 | + assert inspect.getcallargs(_some_function, 1, 2, 3) == inspect.getcallargs( |
| 114 | + _some_function_traced, 1, 2, 3 |
| 115 | + ) |
0 commit comments