-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add cli argument testing and fix docstrings
- Loading branch information
1 parent
905ead6
commit b825a57
Showing
1 changed file
with
14 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
"""Check that the --config command-line flag works""" | ||
|
||
"""Test user option overrides using --config and load_options""" | ||
from proselint.tools import load_options | ||
|
||
|
||
def test_load_options_function(): | ||
"""Test load_options by specifying a user options path""" | ||
overrides = load_options("tests/test_config_flag_proselintrc") | ||
assert load_options()["checks"]["uncomparables.misc"] | ||
assert not overrides["checks"]["uncomparables.misc"] | ||
|
||
|
||
def test_load_fallbacks(): | ||
"""Test load_options with a fallback path""" | ||
fallbacks = load_options(None, ["tests/test_config_flag_proselintrc"]) | ||
assert not fallbacks["checks"]["uncomparables.misc"] | ||
fallbacks = load_options(None, ["./.proselintrc"]) | ||
assert fallbacks["checks"]["uncomparables.misc"] | ||
|
||
|
||
def test_config_flag(): | ||
"""Test the --config CLI argument""" | ||
output = subprocess.run(["python", "-m", "proselint", "--demo"], | ||
stdout=subprocess.PIPE, encoding='utf-8') | ||
assert "uncomparables.misc" in output.stdout | ||
output = subprocess.run(["python", "-m", "proselint", "--demo", "--config", | ||
"tests/test_config_flag_proselintrc"], | ||
stdout=subprocess.PIPE, encoding='utf-8') | ||
assert "uncomparables.misc" not in output.stdout |