Skip to content

Commit febdc21

Browse files
authored
remove unused constants (#146)
* 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>
1 parent 37e32d6 commit febdc21

2 files changed

Lines changed: 12 additions & 39 deletions

File tree

src/ansible_creator/constants.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,5 @@
11
"""Definition of constants for this package."""
22

3-
MessageColors = {
4-
"HEADER": "\033[94m",
5-
"OKGREEN": "\033[92m",
6-
"WARNING": "\033[93m",
7-
"FAILURE": "\033[1;31m",
8-
"OK": "\033[95m",
9-
"ENDC": "\033[0m",
10-
}
11-
12-
OPTION_CONDITIONALS = (
13-
"mutually_exclusive",
14-
"required_one_of",
15-
"required_together",
16-
"required_by",
17-
"required_if",
18-
)
19-
20-
OPTION_METADATA = (
21-
"type",
22-
"choices",
23-
"default",
24-
"required",
25-
"aliases",
26-
"elements",
27-
"fallback",
28-
"no_log",
29-
"apply_defaults",
30-
"deprecated_aliases",
31-
"removed_in_version",
32-
)
33-
34-
VALID_ANSIBLEMODULE_ARGS = (
35-
"bypass_checks",
36-
"no_log",
37-
"add_file_common_args",
38-
"supports_check_mode",
39-
*OPTION_CONDITIONALS,
40-
)
41-
423
GLOBAL_TEMPLATE_VARS = {
434
"DEV_CONTAINER_IMAGE": "ghcr.io/ansible/community-ansible-dev-tools:latest",
445
"DEV_FILE_IMAGE": "ghcr.io/ansible/community-ansible-devspaces:latest",

tests/units/test_basic.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from ansible_creator.config import Config
1010
from ansible_creator.utils import expand_path, TermFeatures
1111
from ansible_creator.output import Output
12+
from ansible_creator.templar import Templar
1213

1314

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

150151

152+
def test_missing_j2(monkeypatch) -> None:
153+
"""Test missing Jinja2."""
154+
fail_msg = (
155+
"jinja2 is required but does not appear to be installed."
156+
"It can be installed using `pip install jinja2`"
157+
)
158+
monkeypatch.setattr("ansible_creator.templar.HAS_JINJA2", False)
159+
with pytest.raises(ImportError, match=fail_msg):
160+
Templar()
161+
162+
151163
def test_cli_init_output(monkeypatch) -> None:
152164
sysargs = [
153165
"ansible-creator",

0 commit comments

Comments
 (0)