Add --enable-extensions flag to Flake8

This new flag is added so that off-by-default extensions can be enabled
without using --select which (currently) causes several problems with
pep8's rule engine. This also adds support to the --enable-extensions
flag to be specified as a multi-line config option in an appropriate
config file.

Closes GitLab #67
This commit is contained in:
Ian Cordasco 2015-09-27 09:45:35 -05:00
parent 5b7dc3927a
commit 96cb23e2e7
2 changed files with 37 additions and 6 deletions

View file

@ -56,6 +56,18 @@ class TestEngine(unittest.TestCase):
self.assertTrue(isinstance(i, list))
self.assertTrue(register_check.called)
def test_disable_extensions(self):
parser = mock.MagicMock()
options = mock.MagicMock()
parser.ignored_extensions = ['I123', 'I345', 'I678', 'I910']
options.enabled_extensions = 'I345,\nI678,I910'
options.ignore = ('E121', 'E123')
engine._disable_extensions(parser, options)
self.assertEqual(set(options.ignore), set(['E121', 'E123', 'I123']))
def test_get_parser(self):
# setup
re = self.start_patch('flake8.engine._register_extensions')