Skip to content

Commit

Permalink
feat: integrate rich-click
Browse files Browse the repository at this point in the history
  • Loading branch information
browniebroke committed Feb 27, 2022
1 parent 6050655 commit 2bcabc6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
18 changes: 17 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ click = "<9"
libcst = "==0.4.1"
pathspec = ">=0.6,<1"
rich = "<12"
rich-click = ">=1.0"

# Docs deps
Sphinx = { version = "^4.0", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion src/django_codemod/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pathlib import Path
from typing import Callable, Dict, Generator, List, Optional, Tuple, Type

import click
import rich_click as click
from libcst.codemod import CodemodContext, parallel_exec_transform_with_prettyprint
from rich.console import Console
from rich.markdown import Markdown
Expand Down
10 changes: 8 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def test_missing_argument(cli_runner):
result = cli_runner.invoke(cli.djcodemod, ["run"])

assert result.exit_code == 2
assert "Error: Missing argument 'SRC...'" in result.output
assert "Error" in result.output
assert "Missing argument" in result.output
assert "'SRC...'" in result.output


def test_no_mods_selected(cli_runner):
Expand Down Expand Up @@ -74,7 +76,11 @@ def test_non_supported_version(cli_runner, option, version):
result = cli_runner.invoke(cli.djcodemod, ["run", option, version, "."])

assert result.exit_code == 2
assert f"'{version}' is not supported. Versions supported:" in result.output
assert (
f"Invalid value for '{option}': "
f"'{version}' is not supported." in result.output
)
assert "supported:" in result.output


def test_invalid_version(cli_runner):
Expand Down

0 comments on commit 2bcabc6

Please sign in to comment.