summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Bryant <leachim@leachim.info>2012-12-06 17:44:37 +0000
committerMike Bryant <leachim@leachim.info>2012-12-06 17:44:37 +0000
commit19a54ae055682f14a7e7646538f938c959735be3 (patch)
tree2840af27381608bad6ea317a006b3e23ff7b3fce /test
parentc37940a66c238a5ed8018544948939e394d28458 (diff)
downloadpylint-19a54ae055682f14a7e7646538f938c959735be3.tar.gz
closes #113231. logging checker now looks at instances of Logger classes in addition to the base logging module.
Diffstat (limited to 'test')
-rw-r--r--test/input/func_bug113231.py24
-rw-r--r--test/messages/func_bug113231.txt2
2 files changed, 26 insertions, 0 deletions
diff --git a/test/input/func_bug113231.py b/test/input/func_bug113231.py
new file mode 100644
index 0000000..b5b5d8a
--- /dev/null
+++ b/test/input/func_bug113231.py
@@ -0,0 +1,24 @@
+# pylint: disable=E1101
+# pylint: disable=C0103
+# pylint: disable=R0903
+"""test bugfix for #113231 in logging checker
+"""
+
+__revision__ = ''
+
+# Muck up the names in an effort to confuse...
+import logging as renamed_logging
+
+class Logger(object):
+ """Fake logger"""
+ pass
+
+logger = renamed_logging.getLogger(__name__)
+fake_logger = Logger()
+
+# Statements that should be flagged:
+renamed_logging.warn('%s, %s' % (4, 5))
+logger.warn('%s' % 5)
+
+# Statements that should not be flagged:
+fake_logger.warn('%s' % 5)
diff --git a/test/messages/func_bug113231.txt b/test/messages/func_bug113231.txt
new file mode 100644
index 0000000..a9d3f7e
--- /dev/null
+++ b/test/messages/func_bug113231.txt
@@ -0,0 +1,2 @@
+W: 20: Specify string format arguments as logging function parameters
+W: 21: Specify string format arguments as logging function parameters