diff --git a/CHANGELOG.md b/CHANGELOG.md index 467ce59b..a40c7aba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # unreleased * Only parse format strings when being used with `locals()` (jingw, #225). +* Don't override paths in pyproject.toml with empty CLI paths (bcbnz, #228). # 2.1 (2020-08-19) diff --git a/tests/test_config.py b/tests/test_config.py index 4a9a9075..f7d3e5cd 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -147,6 +147,27 @@ def test_config_merging_missing(): assert result["ignore_names"] == ["name1"] +def test_config_merging_toml_paths_only(): + """ + If we have paths in the TOML but not on the CLI, the TOML paths should be + used. + """ + toml = StringIO( + dedent( + """\ + [tool.vulture] + paths = ["path1", "path2"] + """ + ) + ) + cliargs = [ + "--exclude=test_*.py", + ] + result = make_config(cliargs, toml) + assert result["paths"] == ["path1", "path2"] + assert result["exclude"] == ["test_*.py"] + + def test_invalid_config_options_output(): """ If the config file contains unknown options we want to abort. diff --git a/vulture/config.py b/vulture/config.py index 45ae0c38..a9a222e8 100644 --- a/vulture/config.py +++ b/vulture/config.py @@ -100,6 +100,7 @@ def csv(exclude): "paths", nargs="*", metavar="PATH", + default=missing, help="Paths may be Python files or directories. For each directory" " Vulture analyzes all contained *.py files.", )