From febdc218377ecf4ade05d23aa53ed4fa5468737c Mon Sep 17 00:00:00 2001 From: Nilashish Chakraborty Date: Mon, 22 Apr 2024 12:14:11 +0530 Subject: [PATCH] remove unused constants (#146) * remove unused constants Signed-off-by: NilashishC * bump coverage Signed-off-by: NilashishC --------- Signed-off-by: NilashishC --- src/ansible_creator/constants.py | 39 -------------------------------- tests/units/test_basic.py | 12 ++++++++++ 2 files changed, 12 insertions(+), 39 deletions(-) diff --git a/src/ansible_creator/constants.py b/src/ansible_creator/constants.py index 15c19c8..82bc052 100644 --- a/src/ansible_creator/constants.py +++ b/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", diff --git a/tests/units/test_basic.py b/tests/units/test_basic.py index 0f7015b..c0d9464 100644 --- a/tests/units/test_basic.py +++ b/tests/units/test_basic.py @@ -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: @@ -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",