Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/robot/example.robot
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ${MESSAGE} Hello,
*** Test Cases ***
First Test
[Documentation] Thorough and relatively lengthy documentation for the example test case that
... logs ${MESSAGE} and ${NAD} and ${NAMES}.
... logs ${MESSAGE} and ${NAD} and ${NAMES}. %{RUNTIME_VAR}
[Tags] SWRQT-SOME_RQT ANOTHER-TAG SWRQT-OTHER_RQT SYSRQT-SOME_SYSTEM_RQT
Log ${MESSAGE}
Log ${NAD}
Expand Down
6 changes: 6 additions & 0 deletions mlx/robot2rst/robot_parser.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import re
from collections import namedtuple

Expand Down Expand Up @@ -66,6 +67,11 @@ def visit_TestCase(self, node):
previous_token = token
elif element_type == Token.TAGS:
tags = [el.value for el in element.tokens if el.type == Token.ARGUMENT]

for var_name in re.findall(r'%\{(.+?)\}', doc):
if var_name in os.environ:
doc = doc.replace(f'%{{{var_name}}}', os.environ[var_name])

if self.evaluate_inclusion(tags):
self.tests.append(self.TestAttributes(node.name, doc, tags))

Expand Down
5 changes: 5 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ commands =
flake8 mlx setup.py

[testenv:sphinx2.4.5]
setenv =
RUNTIME_VAR = Test env variable
deps=
{[testenv]deps}
setuptools<70
jinja2 == 2.11.3
markupsafe == 1.1.0
docutils == 0.17
Expand All @@ -67,6 +70,8 @@ commands=
mlx-warnings --config warnings_config.yml --command make -C doc html

[testenv:sphinx-latest]
setenv =
RUNTIME_VAR = Test env variable
deps=
{[testenv]deps}
sphinx
Expand Down