Skip to content

Commit

Permalink
test: add cli argument testing and fix docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
Nytelife26 authored May 24, 2021
1 parent 905ead6 commit b825a57
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/test_config_flag.py
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

0 comments on commit b825a57

Please sign in to comment.