Skip to content

Commit

Permalink
remove unused constants (#146)
Browse files Browse the repository at this point in the history
* remove unused constants

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

* bump coverage

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

---------

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
  • Loading branch information
NilashishC committed Apr 22, 2024
1 parent 37e32d6 commit febdc21
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 39 deletions.
39 changes: 0 additions & 39 deletions src/ansible_creator/constants.py
@@ -1,44 +1,5 @@
"""Definition of constants for this package."""

MessageColors = {
"HEADER": "\033[94m",
"OKGREEN": "\033[92m",
"WARNING": "\033[93m",
"FAILURE": "\033[1;31m",
"OK": "\033[95m",
"ENDC": "\033[0m",
}

OPTION_CONDITIONALS = (
"mutually_exclusive",
"required_one_of",
"required_together",
"required_by",
"required_if",
)

OPTION_METADATA = (
"type",
"choices",
"default",
"required",
"aliases",
"elements",
"fallback",
"no_log",
"apply_defaults",
"deprecated_aliases",
"removed_in_version",
)

VALID_ANSIBLEMODULE_ARGS = (
"bypass_checks",
"no_log",
"add_file_common_args",
"supports_check_mode",
*OPTION_CONDITIONALS,
)

GLOBAL_TEMPLATE_VARS = {
"DEV_CONTAINER_IMAGE": "ghcr.io/ansible/community-ansible-dev-tools:latest",
"DEV_FILE_IMAGE": "ghcr.io/ansible/community-ansible-devspaces:latest",
Expand Down
12 changes: 12 additions & 0 deletions tests/units/test_basic.py
Expand Up @@ -9,6 +9,7 @@
from ansible_creator.config import Config
from ansible_creator.utils import expand_path, TermFeatures
from ansible_creator.output import Output
from ansible_creator.templar import Templar


def test_expand_path() -> None:
Expand Down Expand Up @@ -148,6 +149,17 @@ def test_cli_parser(monkeypatch, sysargs, expected) -> None:
assert vars(Cli().parse_args()) == expected


def test_missing_j2(monkeypatch) -> None:
"""Test missing Jinja2."""
fail_msg = (
"jinja2 is required but does not appear to be installed."
"It can be installed using `pip install jinja2`"
)
monkeypatch.setattr("ansible_creator.templar.HAS_JINJA2", False)
with pytest.raises(ImportError, match=fail_msg):
Templar()


def test_cli_init_output(monkeypatch) -> None:
sysargs = [
"ansible-creator",
Expand Down

0 comments on commit febdc21

Please sign in to comment.