Repository navigation
Narrow down the scope of ReST parsing. - #4085
Conversation
Ignore unknown and non-relevant directives and roles.
|
To put things in context, I'm using RobotFramework for RPA and attempting to use the same ReST file to describe the automation and to layout its output in a document. Thus, not all files that'd be required to render the ReST file are present at the time it is parsed by RobotFramework. This patch allows RobotFramework to pick up what it needs from the ReST and nothing else. |
|
Could you clarify why this change is needed? More precisely, how is this better than what was done in #2093? It might be best to submit a separate issue explaining that. We anyway want to have issues for tracking purposes. On a quick look the code looks ok but lacks tests. If we decide to add this, I'll review the PR more closely. |
In the situation I described above, #2093 won't do. Parsing a
Got it. I took a look at the CONTRIBUTING guidelines and it wasn't clear to me whether you always had a tracking issue or not. I'll open one ASAP.
I did extend one of the acceptance tests. Would you like to have a unit test for |
|
So this fix is more general than what we have? Sounds good to me. I missed that you had modified test data in this regard. Didn't know |
|
As I commented #4086, this PR needs to be Python 2 compatible if we want it in RF 4.1.2. Looking at the code the only problem is from robot.utils import PY2
...
@functools.wraps(directives.directive)
def directive(*args, **kwargs):
...
@functools.wraps(roles.role)
def role(*args, **kwargs):
...
if PY2:
directive.__wrapped__ = directives.directive
role.__wrapped__ = roles.role
directives.directive = directive
roles.role = role |
|
@pekkaklarck suggestion applied in 35393bc. |
|
@pekkaklarck acceptance tests for ReST format parsing pass locally for Python 2.7.18 and Python 3.8.10 using Could we fire up the workflows in this PR? |
|
Thanks for the PR @hidmic! |
Closes #4086. This patch decorates
docutilsfunctionality so as to ignore every directive and role that is not directly relevant to RobotFramework. Alternative to error suppression (throughreport_levelconfiguration, see #2093).