Commit e061eb1
fix(arq): handle settings_cls passed as keyword argument (#5393)
The `_sentry_create_worker` patch assumed `settings_cls` is always
passed as positional arg (`args[0]`), causing IndexError when users call
`create_worker(settings_cls=WorkerSettings)`.
Now checks both `args[0]` and `kwargs.get("settings_cls")`.
Test added in `tests/integrations/arq/test_arq.py` as
`init_arq_with_kwarg_settings`
### Description
`settings_cls` is now checked from kwargs if no args
```py
settings_cls = args[0] if args else kwargs.get("settings_cls")
```
#### Issues
* None
---------
Co-authored-by: Ivana Kellyer <ivana.kellyer@sentry.io>1 parent 30e3f8c commit e061eb1
File tree
2 files changed
+56
-6
lines changed- sentry_sdk/integrations
- tests/integrations/arq
2 files changed
+56
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
204 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
205 | 206 | | |
206 | 207 | | |
207 | | - | |
| 208 | + | |
208 | 209 | | |
209 | | - | |
| 210 | + | |
210 | 211 | | |
211 | 212 | | |
212 | 213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
134 | 182 | | |
135 | 183 | | |
136 | | - | |
| 184 | + | |
| 185 | + | |
137 | 186 | | |
138 | 187 | | |
139 | 188 | | |
| |||
0 commit comments