Skip to content

Commit

Permalink
test(config-flag): fix for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Nytelife26 committed Sep 9, 2023
1 parent 690f8c0 commit e18a866
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
File renamed without changes.
9 changes: 5 additions & 4 deletions tests/test_config_flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

runner = CliRunner()

CONFIG_FILE = Path(__file__, "../test_config_flag_proselintrc.json").resolve()
CONFIG_FILE = str(Path(__file__, "../test-proselintrc.json").resolve())


def test_deepmerge_dicts():
Expand All @@ -27,7 +27,7 @@ def test_deepmerge_dicts():
def test_load_options_function(isfile):
"""Test load_options by specifying a user options path"""

isfile.side_effect = str(CONFIG_FILE).__eq__
isfile.side_effect = CONFIG_FILE.__eq__

overrides = load_options(CONFIG_FILE, default)
assert load_options(conf_default=default)["checks"]["uncomparables.misc"]
Expand All @@ -43,8 +43,9 @@ def test_config_flag():
output = runner.invoke(proselint, "--demo")
assert "uncomparables.misc" in output.stdout

output = runner.invoke(proselint, f"--demo --config {CONFIG_FILE}")
output = runner.invoke(proselint, f"--demo --config '{CONFIG_FILE}'")
assert "uncomparables.misc" not in output.stdout
assert "FileNotFoundError" != output.exc_info[0].__name__

output = runner.invoke(proselint, "--demo --config non_existent_file")
assert output.exit_code == 1
Expand All @@ -59,5 +60,5 @@ def test_dump_config():
output = runner.invoke(proselint, "--dump-default-config")
assert json.loads(output.stdout) == default

output = runner.invoke(proselint, f"--dump-config --config {CONFIG_FILE}")
output = runner.invoke(proselint, f"--dump-config --config '{CONFIG_FILE}'")
assert json.loads(output.stdout) == json.load(open(CONFIG_FILE))

0 comments on commit e18a866

Please sign in to comment.