summaryrefslogtreecommitdiff
path: root/pylint/test/test_self.py
diff options
context:
space:
mode:
authorMoises Lopez - https://www.vauxoo.com/ <moylop260@vauxoo.com>2016-08-22 03:55:59 -0500
committerClaudiu Popa <pcmanticore@gmail.com>2016-08-22 11:55:59 +0300
commitbd4d65ec0c142ddd4a6fc3ac348ff4f59ba845ca (patch)
tree039095cd428cf4c4a021def92f46d10ffb9a2593 /pylint/test/test_self.py
parent61d208c806f37dae74c71191bbff25a1042e6eac (diff)
downloadpylint-git-bd4d65ec0c142ddd4a6fc3ac348ff4f59ba845ca.tar.gz
Support having plugins with options, sharing the same name
We do support plugins that have the same name, but when both of them are adding options that can be used, pylint crashes, since it already processed the options of the first plugin, introducing the plugin section in the configuration. The patch verifies that an option group already exists and if so, it does not add the same section twice, thus avoiding the duplicate section error.
Diffstat (limited to 'pylint/test/test_self.py')
-rw-r--r--pylint/test/test_self.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/pylint/test/test_self.py b/pylint/test/test_self.py
index 1881199ab..3ad5f30f1 100644
--- a/pylint/test/test_self.py
+++ b/pylint/test/test_self.py
@@ -134,7 +134,7 @@ class RunTC(unittest.TestCase):
output = out.getvalue()
# Get rid of the pesky messages that pylint emits if the
# configuration file is not found.
- master = re.search("\[MASTER", output)
+ master = re.search("\[MASTER", output)
out = six.StringIO(output[master.start():])
parser = six.moves.configparser.RawConfigParser()
parser.readfp(out)
@@ -336,6 +336,26 @@ class RunTC(unittest.TestCase):
self._test_output([path, "--rcfile=%s" % config_path, "-rn"],
expected_output=expected)
+ def test_pylintrc_plugin_duplicate_options(self):
+ dummy_plugin_path = join(HERE, 'regrtest_data', 'dummy_plugin')
+ # Enable --load-plugins=dummy_plugin
+ sys.path.append(dummy_plugin_path)
+ config_path = join(HERE, 'regrtest_data', 'dummy_plugin.rc')
+ expected = (
+ ":dummy-message-01 (I9061): *Dummy short desc 01*\n"
+ " Dummy long desc This message belongs to the dummy_plugin checker.\n\n"
+ ":dummy-message-02 (I9060): *Dummy short desc 02*\n"
+ " Dummy long desc This message belongs to the dummy_plugin checker.")
+ self._test_output(["--rcfile=%s" % config_path,
+ "--help-msg=dummy-message-01,dummy-message-02"],
+ expected_output=expected)
+ expected = (
+ "[DUMMY_PLUGIN]\n\n# Dummy option 1\ndummy_option_1=dummy value 1\n\n"
+ "# Dummy option 2\ndummy_option_2=dummy value 2")
+ self._test_output(["--rcfile=%s" % config_path, "--generate-rcfile"],
+ expected_output=expected)
+ sys.path.remove(dummy_plugin_path)
+
def test_pylintrc_comments_in_values(self):
path = join(HERE, 'regrtest_data', 'test_pylintrc_comments.py')
config_path = join(HERE, 'regrtest_data', 'comments_pylintrc')