Skip to content

Commit 141da43

Browse files
committed
Fix another false positive
Added corresponding test
1 parent 693ea14 commit 141da43

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

tools/pylint-extensions/azure-pylint-guidelines-checker/tests/test_files/do_not_log_exceptions.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,18 @@ def test_other_logging_fails():
6262
return False
6363

6464

65-
# test_no_logging_ok
66-
def test_no_logging_ok():
65+
# test_no_logging_and_no_exception_name_ok
66+
def test_no_logging_and_no_exception_name_ok():
6767
try:
6868
add = 1 + 2
6969
except Exception as ex:
7070
self.errors.appendleft(ex)
71+
except Exception as ex: # pylint: disable=broad-except
72+
_logger.warning(
73+
"Exception occurred when instrumenting: %s.",
74+
lib_name,
75+
exc_info=ex,
76+
)
7177

7278

7379
# test_logging_without_exception_name

tools/pylint-extensions/azure-pylint-guidelines-checker/tests/test_pylint_custom_plugins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5392,7 +5392,7 @@ def test_other_logging_fails(self, setup):
53925392
):
53935393
self.checker.visit_try(try_node)
53945394

5395-
def test_no_logging_ok(self, setup):
5395+
def test_no_logging_and_no_exception_name_ok(self, setup):
53965396
"""Check that no logging is ok in the exception block."""
53975397
try_node = setup.body[6].body[0]
53985398
with self.assertNoMessages():

0 commit comments

Comments
 (0)