Skip to content

Commit

Permalink
completions: Split up the tests
Browse files Browse the repository at this point in the history
Summary: Instead of having one test that tests both of zsh and bash, make two different test instances. This makes the tests faster to run and easier to debug

Reviewed By: stepancheg

Differential Revision: D63085148

fbshipit-source-id: 1ce1a1c7f163666a067def80106a65e9074be9c8
  • Loading branch information
JakobDegen authored and facebook-github-bot committed Sep 21, 2024
1 parent 04e6f1d commit 44c2e5a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/e2e/completion/test_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ def completion_test(
shells: list[str] = SHELLS,
options_only: bool = False,
) -> None:
async def impl(buck: Buck) -> None:
tmp_path = Path(buck.cwd).parent / "tmp"
tmp_path.mkdir(exist_ok=True)
for shell in shells:

verify_bin = Path(os.environ["BUCK2_COMPLETION_VERIFY"])
# shell=shell is a trick to get the variable captured by value
async def impl(buck: Buck, shell: str = shell) -> None:
tmp_path = Path(buck.cwd).parent / "tmp"
tmp_path.mkdir(exist_ok=True)

verify_bin = Path(os.environ["BUCK2_COMPLETION_VERIFY"])

for shell in shells:
if shell not in SHELLS:
continue
get_completions = await buck.completion(
shell, *(["--options-only"] if options_only else [])
)
Expand Down Expand Up @@ -72,7 +72,7 @@ async def impl(buck: Buck) -> None:
else:
assert expected(actual), "testing shell: " + shell

globals()[name] = buck_test(inplace=False)(impl)
globals()[name + "_" + shell] = buck_test(inplace=False)(impl)


completion_test(
Expand Down

0 comments on commit 44c2e5a

Please sign in to comment.