Skip to content

Commit

Permalink
remove test with shell_complete in Option
Browse files Browse the repository at this point in the history
  • Loading branch information
svlandeg committed Sep 5, 2024
1 parent 286b94e commit ca4ca2c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
12 changes: 1 addition & 11 deletions tests/assets/compat_click7_8.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
from typing import List

import click
import typer

app = typer.Typer()


def shell_complete(
ctx: click.Context, param: click.Parameter, incomplete: str
) -> List[str]:
return ["Jonny"]


@app.command(context_settings={"auto_envvar_prefix": "TEST"})
def main(
name: str = typer.Option("John", hidden=True),
lastname: str = typer.Option("Doe", "/lastname", show_default="Mr. Doe"),
age: int = typer.Option(lambda: 42, show_default=True),
nickname: str = typer.Option("", shell_complete=shell_complete),
):
"""
Say hello.
"""
print(f"Hello {name} {lastname}, it seems you have {age}, {nickname}")
print(f"Hello {name} {lastname}, it seems you have {age}")


if __name__ == "__main__":
Expand Down
18 changes: 0 additions & 18 deletions tests/test_compat/test_option_get_help.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import os
import subprocess
import sys

import typer.core
from typer.testing import CliRunner

Expand Down Expand Up @@ -37,17 +33,3 @@ def test_coverage_call():
result = runner.invoke(mod.app)
assert result.exit_code == 0
assert "Hello John Doe, it seems you have 42" in result.output


def test_completion():
result = subprocess.run(
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
capture_output=True,
encoding="utf-8",
env={
**os.environ,
"_COMPAT_CLICK7_8.PY_COMPLETE": "complete_zsh",
"_TYPER_COMPLETE_ARGS": "compat_click7_8.py --nickname ",
},
)
assert "Jonny" in result.stdout

0 comments on commit ca4ca2c

Please sign in to comment.