mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-20071 Fixed: Nonexistent logger methods should be mark as unresolved
PY-19716 Fixed: logger.exception() without arguments doesn't show a warning Skeleton for logging.getLogger was accidentally pushed to primary python-skeletons repo and then was synced with current repo. So there is no skeleton in affected files but tests are based on it. At first logger.getLogger returned union of Logger and RootLogger. RootLogger just inherits Logger and doesn't introduce any additional functionality. But there was a problem with PyArgumentListInspection which doesn't work in case of many callees (e.g. logger.exception). So skeleton was updated to return only logger from logging.getLogger.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
"""Skeleton for 'logging' stdlib module."""
|
||||
|
||||
import logging
|
||||
|
||||
|
||||
def getLogger(name=None):
|
||||
"""
|
||||
:type name: string
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
def getLogger():
|
||||
pass
|
||||
|
||||
def exception(msg):
|
||||
pass
|
||||
|
||||
class Logger(object):
|
||||
def exception(self, msg):
|
||||
pass
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.exception(<warning descr="Parameter 'msg' unfilled">)</warning>
|
||||
logging.exception(<warning descr="Parameter 'msg' unfilled">)</warning>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.<warning descr="Unresolved attribute reference 'foobar' for class 'Logger'">foobar</warning>()
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
def getLogger():
|
||||
pass
|
||||
|
||||
class Logger(object):
|
||||
def exception(self, msg):
|
||||
pass
|
||||
@@ -212,6 +212,16 @@ public class PyArgumentListInspectionTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-19716
|
||||
public void testMethodsForLoggingExceptions() {
|
||||
final String folderPath = "inspections/PyArgumentListInspection/" + getTestName(false) + "/";
|
||||
|
||||
myFixture.copyDirectoryToProject(folderPath, "");
|
||||
myFixture.configureFromTempProjectFile("methodsForLoggingExceptions.py");
|
||||
myFixture.enableInspections(PyArgumentListInspection.class);
|
||||
myFixture.checkHighlighting(true, false, false);
|
||||
}
|
||||
|
||||
// PY-19522
|
||||
public void testCsvRegisterDialect() {
|
||||
final String folderPath = "inspections/PyArgumentListInspection/" + getTestName(false) + "/";
|
||||
|
||||
+5
@@ -729,6 +729,11 @@ public class PyUnresolvedReferencesInspectionTest extends PyInspectionTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-20071
|
||||
public void testNonexistentLoggerMethod() {
|
||||
doMultiFileTest();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Class<? extends PyInspection> getInspectionClass() {
|
||||
|
||||
Reference in New Issue
Block a user