|
14 | 14 | from sentry_sdk.integrations import DidNotEnable |
15 | 15 | from sentry_sdk.integrations.launchdarkly import LaunchDarklyIntegration |
16 | 16 |
|
17 | | -# Docs reference: https://launchdarkly-python-sdk.readthedocs.io/en/latest/api-testing.html#ldclient.integrations.test_data.TestData |
18 | | - |
19 | 17 |
|
20 | 18 | @pytest.mark.parametrize( |
21 | 19 | "use_global_client", |
@@ -55,16 +53,16 @@ def test_launchdarkly_integration_threaded(sentry_init): |
55 | 53 | context = Context.create("user1") |
56 | 54 |
|
57 | 55 | def task(flag_key): |
58 | | - # Create a new isolation scope for the thread. This means the evaluations in each task are captured separately. |
| 56 | + # Creates a new isolation scope for the thread. |
| 57 | + # This means the evaluations in each task are captured separately. |
59 | 58 | with sentry_sdk.isolation_scope(): |
60 | 59 | client.variation(flag_key, context, False) |
61 | 60 | return [f["flag"] for f in sentry_sdk.get_current_scope().flags.get()] |
62 | 61 |
|
63 | 62 | td.update(td.flag("hello").variation_for_all(True)) |
64 | 63 | td.update(td.flag("world").variation_for_all(False)) |
65 | | - client.variation( |
66 | | - "hello", context, False |
67 | | - ) # Captured before splitting isolation scopes. |
| 64 | + # Capture an eval before we split isolation scopes. |
| 65 | + client.variation("hello", context, False) |
68 | 66 |
|
69 | 67 | with cf.ThreadPoolExecutor(max_workers=2) as pool: |
70 | 68 | results = list(pool.map(task, ["world", "other"])) |
@@ -99,7 +97,8 @@ async def runner(): |
99 | 97 |
|
100 | 98 | def test_launchdarkly_integration_did_not_enable(monkeypatch): |
101 | 99 | # Client is not passed in and set_config wasn't called. |
102 | | - # Bad practice to access internals like this. TODO: can skip this test, or remove this case entirely (force user to pass in a client instance). |
| 100 | + # TODO: Bad practice to access internals like this. We can skip this test, or remove this |
| 101 | + # case entirely (force user to pass in a client instance). |
103 | 102 | ldclient._reset_client() |
104 | 103 | try: |
105 | 104 | ldclient.__lock.lock() |
|
0 commit comments