Skip to content

Commit

Permalink
Merge pull request #213 from neutrinoceros/hotfix_niche_case
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Sep 8, 2023
2 parents f7f8a24 + bfd793d commit 86aacbe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/wxc/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def main(argv: list[str] | None = None) -> int:
)
args = parser.parse_args(argv)

if args.show_lines and not args.source:
print_err("--lines flag is meaningless if --source isn't passed too")
return 1

if "." not in args.name:
# this is a simple module request
# let's try to get the result without actually importing it first
Expand Down
8 changes: 8 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ def test_source_error(capsys):
assert ret2 != 0


def test_lines_no_source(capsys):
ret1 = main(["inspect.getfile", "--lines"])
assert ret1 != 0
out, err = capsys.readouterr()
assert out == ""
assert err == "ERROR --lines flag is meaningless if --source isn't passed too\n"


def test_property(capsys):
ret = main(["rich.progress.Task.started"])
assert ret == 0
Expand Down

0 comments on commit 86aacbe

Please sign in to comment.