Feat: arrange variables for templates

Split in 3 categories
- from "options" key build with default_config, file_config and cli options
- from "subject" key build csv or quantity of subject
- other in direct access from "direct_access" dictionnary inside the
  file_config
This commit is contained in:
2022-07-20 16:16:09 +02:00
parent 37d779c0ab
commit 67656c2cf1
8 changed files with 147 additions and 61 deletions

View File

@@ -27,7 +27,13 @@ def test_generate(template_path, jinja2_env):
output = "output"
message = generate(
args={"a": 2, "jinja2": {"environment": jinja2_env}},
args={
"options": {
"direct_access": {"a": 2},
"jinja2": {"environment": jinja2_env},
},
"subject": {},
},
deps=[template],
output=output,
)
@@ -59,10 +65,18 @@ def test_generate_with_random(template_path_with_random, jinja2_env):
import random
message = generate(
args={"random": random, "jinja2": {"environment": jinja2_env}},
args={
"options": {
"jinja2": {"environment": jinja2_env},
"direct_access": {
"random": random,
}
},
"subject":{},
},
deps=[template],
output=output,
)
)
print(message.err)
assert message.status == 0