utils: Change normalize_paths() contract

The `normalize_paths()` utility was doing too much — parsing
unstructured configuration path data and dispatching the scrubbed paths
to be normalized.

Towards moving the parsing of unstructured configuration path data
closer towards were configuration occurs, have the utility accept only
structured input for normalizing paths.
This commit is contained in:
Eric N. Vander Weele 2019-07-28 10:39:27 -04:00
parent a0cd55fd6d
commit 1ba56b9056
3 changed files with 9 additions and 12 deletions

View file

@ -127,14 +127,13 @@ def test_normalize_path(value, expected):
@pytest.mark.parametrize("value,expected", [
("flake8,pep8,pyflakes,mccabe", ["flake8", "pep8", "pyflakes", "mccabe"]),
("flake8,\n\tpep8,\n pyflakes,\n\n mccabe",
(["flake8", "pep8", "pyflakes", "mccabe"],
["flake8", "pep8", "pyflakes", "mccabe"]),
("../flake8,../pep8,../pyflakes,../mccabe",
(["../flake8", "../pep8", "../pyflakes", "../mccabe"],
[os.path.abspath("../" + p) for p in RELATIVE_PATHS]),
])
def test_normalize_paths(value, expected):
"""Verify we normalize comma-separated paths provided to the tool."""
"""Verify we normalizes a sequence of paths provided to the tool."""
assert utils.normalize_paths(value) == expected