Merge branch 'bug/330' into 'master'

Filter out empty ignore/select codes

Closes #330

See merge request !184
This commit is contained in:
Ian Cordasco 2017-05-21 01:34:34 +00:00
commit 24129d846c
2 changed files with 7 additions and 1 deletions

View file

@ -29,7 +29,8 @@ def parse_comma_separated_list(value):
if not isinstance(value, (list, tuple)):
value = value.split(',')
return [item.strip() for item in value]
item_gen = (item.strip() for item in value)
return [item for item in item_gen if item]
def normalize_paths(paths, parent=os.curdir):

View file

@ -13,8 +13,13 @@ RELATIVE_PATHS = ["flake8", "pep8", "pyflakes", "mccabe"]
@pytest.mark.parametrize("value,expected", [
("E123,\n\tW234,\n E206", ["E123", "W234", "E206"]),
("E123,W234,E206", ["E123", "W234", "E206"]),
("E123,W234,E206,", ["E123", "W234", "E206"]),
("E123,W234,,E206,,", ["E123", "W234", "E206"]),
("E123,,W234,,E206,,", ["E123", "W234", "E206"]),
(["E123", "W234", "E206"], ["E123", "W234", "E206"]),
(["E123", "\n\tW234", "\n E206"], ["E123", "W234", "E206"]),
(["E123", "\n\tW234", "\n E206", "\n"], ["E123", "W234", "E206"]),
(["E123", "\n\tW234", "", "\n E206", "\n"], ["E123", "W234", "E206"]),
])
def test_parse_comma_separated_list(value, expected):
"""Verify that similar inputs produce identical outputs."""