tests(BLE.py): add snapshot tests for debug logging

This commit is contained in:
lubaskin 2025-12-18 21:13:44 +03:00
parent 119927e90c
commit d0d99e5e35
2 changed files with 178 additions and 112 deletions

View file

@ -94,6 +94,42 @@ except Exception:
logging.error("...", exc_info=True)
try:
pass
except Exception as e:
logging.error("...", exc_info=e)
try:
pass
except Exception:
logging.debug("...")
try:
pass
except Exception:
logging.debug("...", exc_info=False)
try:
pass
except Exception:
logging.debug("...", exc_info=None)
try:
pass
except Exception:
logging.debug("...", exc_info=True)
try:
pass
except Exception as e:
logging.debug("...", exc_info=e)
from logging import critical, error, exception
try:

View file

@ -105,161 +105,191 @@ BLE001 Do not catch blind exception: `Exception`
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:101:8
--> BLE.py:105:8
|
99 | try:
100 | pass
101 | except Exception:
103 | try:
104 | pass
105 | except Exception:
| ^^^^^^^^^
102 | error("...")
106 | logging.debug("...")
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:107:8
--> BLE.py:111:8
|
105 | try:
106 | pass
107 | except Exception:
109 | try:
110 | pass
111 | except Exception:
| ^^^^^^^^^
108 | error("...", exc_info=False)
112 | logging.debug("...", exc_info=False)
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:113:8
--> BLE.py:117:8
|
111 | try:
112 | pass
113 | except Exception:
115 | try:
116 | pass
117 | except Exception:
| ^^^^^^^^^
114 | error("...", exc_info=None)
118 | logging.debug("...", exc_info=None)
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:119:8
--> BLE.py:137:8
|
117 | try:
118 | pass
119 | except Exception:
135 | try:
136 | pass
137 | except Exception:
| ^^^^^^^^^
120 | critical("...")
138 | error("...")
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:125:8
--> BLE.py:143:8
|
123 | try:
124 | pass
125 | except Exception:
141 | try:
142 | pass
143 | except Exception:
| ^^^^^^^^^
126 | critical("...", exc_info=False)
144 | error("...", exc_info=False)
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:131:8
--> BLE.py:149:8
|
129 | try:
130 | pass
131 | except Exception:
147 | try:
148 | pass
149 | except Exception:
| ^^^^^^^^^
132 | critical("...", exc_info=None)
150 | error("...", exc_info=None)
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:174:9
--> BLE.py:155:8
|
172 | try:
173 | pass
174 | except (Exception,):
153 | try:
154 | pass
155 | except Exception:
| ^^^^^^^^^
156 | critical("...")
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:161:8
|
159 | try:
160 | pass
161 | except Exception:
| ^^^^^^^^^
162 | critical("...", exc_info=False)
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:167:8
|
165 | try:
166 | pass
167 | except Exception:
| ^^^^^^^^^
168 | critical("...", exc_info=None)
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:210:9
|
208 | try:
209 | pass
210 | except (Exception,):
| ^^^^^^^^^
175 | pass
211 | pass
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:179:9
|
177 | try:
178 | pass
179 | except (Exception, ValueError):
| ^^^^^^^^^
180 | pass
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:184:21
|
182 | try:
183 | pass
184 | except (ValueError, Exception):
| ^^^^^^^^^
185 | pass
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:189:21
|
187 | try:
188 | pass
189 | except (ValueError, Exception) as e:
| ^^^^^^^^^
190 | print(e)
|
BLE001 Do not catch blind exception: `BaseException`
--> BLE.py:194:9
|
192 | try:
193 | pass
194 | except (BaseException, TypeError):
| ^^^^^^^^^^^^^
195 | pass
|
BLE001 Do not catch blind exception: `BaseException`
--> BLE.py:199:20
|
197 | try:
198 | pass
199 | except (TypeError, BaseException):
| ^^^^^^^^^^^^^
200 | pass
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:204:9
|
202 | try:
203 | pass
204 | except (Exception, BaseException):
| ^^^^^^^^^
205 | pass
|
BLE001 Do not catch blind exception: `BaseException`
--> BLE.py:209:9
|
207 | try:
208 | pass
209 | except (BaseException, Exception):
| ^^^^^^^^^^^^^
210 | pass
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:215:10
--> BLE.py:215:9
|
213 | try:
214 | pass
215 | except ((Exception, ValueError), TypeError):
| ^^^^^^^^^
215 | except (Exception, ValueError):
| ^^^^^^^^^
216 | pass
|
BLE001 Do not catch blind exception: `BaseException`
--> BLE.py:220:22
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:220:21
|
218 | try:
219 | pass
220 | except (ValueError, (BaseException, TypeError)):
| ^^^^^^^^^^^^^
220 | except (ValueError, Exception):
| ^^^^^^^^^
221 | pass
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:225:21
|
223 | try:
224 | pass
225 | except (ValueError, Exception) as e:
| ^^^^^^^^^
226 | print(e)
|
BLE001 Do not catch blind exception: `BaseException`
--> BLE.py:230:9
|
228 | try:
229 | pass
230 | except (BaseException, TypeError):
| ^^^^^^^^^^^^^
231 | pass
|
BLE001 Do not catch blind exception: `BaseException`
--> BLE.py:235:20
|
233 | try:
234 | pass
235 | except (TypeError, BaseException):
| ^^^^^^^^^^^^^
236 | pass
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:240:9
|
238 | try:
239 | pass
240 | except (Exception, BaseException):
| ^^^^^^^^^
241 | pass
|
BLE001 Do not catch blind exception: `BaseException`
--> BLE.py:245:9
|
243 | try:
244 | pass
245 | except (BaseException, Exception):
| ^^^^^^^^^^^^^
246 | pass
|
BLE001 Do not catch blind exception: `Exception`
--> BLE.py:251:10
|
249 | try:
250 | pass
251 | except ((Exception, ValueError), TypeError):
| ^^^^^^^^^
252 | pass
|
BLE001 Do not catch blind exception: `BaseException`
--> BLE.py:256:22
|
254 | try:
255 | pass
256 | except (ValueError, (BaseException, TypeError)):
| ^^^^^^^^^^^^^
257 | pass
|