Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't override TOML paths with empty CLI paths #228

Merged
merged 1 commit into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
21 changes: 21 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions vulture/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
)
Expand Down