Skip to content

Commit

Permalink
Merge pull request #43 from kamangir/test-refactors-2024-11-23-18284
Browse files Browse the repository at this point in the history
test refactors
  • Loading branch information
kamangir authored Nov 23, 2024
2 parents 4b998ff + e39fcd4 commit df3a92f
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ create a copy of [`sample.env`](./abcli/sample.env) as `.env` and fill in the se

[![pylint](https://github.com/kamangir/awesome-bash-cli/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/awesome-bash-cli/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/awesome-bash-cli/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/awesome-bash-cli/actions/workflows/pytest.yml) [![bashtest](https://github.com/kamangir/awesome-bash-cli/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/awesome-bash-cli/actions/workflows/bashtest.yml) [![PyPI version](https://img.shields.io/pypi/v/abcli.svg)](https://pypi.org/project/abcli/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/abcli)](https://pypistats.org/packages/abcli)

built by 🌀 [`blue_options-4.157.1`](https://github.com/kamangir/awesome-bash-cli), based on 🪄 [`abcli-9.418.1`](https://github.com/kamangir/awesome-bash-cli).
built by 🌀 [`blue_options-4.161.1`](https://github.com/kamangir/awesome-bash-cli), based on 🪄 [`abcli-9.421.1`](https://github.com/kamangir/awesome-bash-cli).
3 changes: 3 additions & 0 deletions abcli/.abcli/tests/help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ function test_abcli_help() {
\
"@sleep" \
\
"@test" \
"@test list" \
\
"@terraform" \
"@terraform cat" \
"@terraform disable" \
Expand Down
2 changes: 1 addition & 1 deletion abcli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

DESCRIPTION = f"{ICON} a language to speak AI."

VERSION = "9.418.1"
VERSION = "9.421.1"

REPO_NAME = "awesome-bash-cli"

Expand Down
2 changes: 0 additions & 2 deletions abcli/help/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
from abcli.help.notebooks import help_functions as help_notebooks
from abcli.help.plugins import help_functions as help_plugins
from abcli.help.open import help_open
from abcli.help.pypi import help_functions as help_pypi
from abcli.help.pytest import help_pytest
from abcli.help.repeat import help_repeat
from abcli.help.sagemaker import help_functions as help_sagemaker
from abcli.help.seed import help_functions as help_seed
Expand Down
4 changes: 3 additions & 1 deletion abcli/help/generic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from typing import List, Dict, Callable, Union

from abcli.help.pytest import help_pytest
from abcli.help.pypi import help_functions as help_pypi
from abcli.help.pytest import help_pytest
from abcli.help.test import help_functions as help_test


def help_functions(
Expand All @@ -14,4 +15,5 @@ def help_functions(
mono=mono,
plugin_name=plugin_name,
),
"test": help_test(plugin_name=plugin_name),
}
75 changes: 75 additions & 0 deletions abcli/help/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
from typing import List, Dict, Callable, Union

from blue_options.terminal import show_usage, xtra


def help_(
tokens: List[str],
mono: bool,
plugin_name: str = "abcli",
) -> str:
options = xtra(
"what=all|<test-name>,dryrun",
mono=mono,
)

test_options = xtra(
"dryrun",
mono=mono,
)

callable = f"{plugin_name} test"

if plugin_name == "abcli":
options = f"{options},plugin=<plugin-name>"
callable = "@test"

return show_usage(
callable.split(" ")
+ [
f"[{options}]",
f"[{test_options}]",
],
f"test {plugin_name}.",
mono=mono,
)


def help_list(
tokens: List[str],
mono: bool,
plugin_name: str = "abcli",
) -> str:
options = "list"

callable = f"{plugin_name} test"

if plugin_name == "abcli":
options = f"{options},plugin=<plugin-name>"
callable = "@test"

return show_usage(
callable.split(" ")
+ [
f"{options}",
],
f"list {plugin_name} tests.",
mono=mono,
)


def help_functions(
plugin_name: str = "abcli",
) -> Union[Callable, Dict[str, Union[Callable, Dict]]]:
return {
"": lambda tokens, mono: help_(
tokens,
mono=mono,
plugin_name=plugin_name,
),
"list": lambda tokens, mono: help_list(
tokens,
mono=mono,
plugin_name=plugin_name,
),
}

0 comments on commit df3a92f

Please sign in to comment.