2024-11-07 22:51:28 +01:00
|
|
|
from pathlib import Path
|
2024-11-15 08:13:45 +01:00
|
|
|
from rougail.config import get_rougail_config
|
2024-11-07 22:51:28 +01:00
|
|
|
from rougail.output_doc import RougailOutputDoc
|
|
|
|
|
|
|
|
|
2024-11-20 21:59:21 +01:00
|
|
|
def test_force_optional():
|
2024-11-07 22:51:28 +01:00
|
|
|
test_dir = Path(__file__).resolve().parent
|
2024-11-15 08:13:45 +01:00
|
|
|
rougailconfig = get_rougail_config(backward_compatibility=False)
|
2024-11-07 22:51:28 +01:00
|
|
|
rougailconfig['step.output'] = 'doc'
|
|
|
|
rougailconfig['force_optional'] = True
|
2024-11-20 21:12:56 +01:00
|
|
|
# rougailconfig['tiramisu_cache'] = 'p.py'
|
2024-11-07 22:51:28 +01:00
|
|
|
dirs = [str(test_dir / 'force_optional')]
|
|
|
|
rougailconfig['main_dictionaries'] = dirs
|
2024-11-20 21:12:56 +01:00
|
|
|
rougailconfig['doc.output_format'] = 'asciidoc'
|
2024-11-07 22:51:28 +01:00
|
|
|
inventory = RougailOutputDoc(rougailconfig=rougailconfig)
|
|
|
|
doc = inventory.gen_doc()
|
|
|
|
result_file = test_dir / 'force_optional.adoc'
|
|
|
|
if not result_file.is_file():
|
|
|
|
with open(str(result_file), 'w') as docfh:
|
|
|
|
docfh.write(doc)
|
|
|
|
with open(str(result_file)) as docfh:
|
|
|
|
result = docfh.read()
|
|
|
|
assert doc == result
|