You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Supress docutils errors/warnings with reST format #2093
When using reST format for writing tests. I'm using the same source file to generate Sphinx documentation. This allows me to have one file for both purposes. The problem is that Sphinx define some non-standard directives that docutils complains about.
Example:
tests/resources/settings.rst:2: (ERROR/3) Unknown directive type "highlight".
.. highlight:: robotframework
bfd_test.rst:15: (ERROR/3) Unknown interpreted text role "ref".
bfd_test.rst:276: (ERROR/3) Unknown directive type "automodule".
.. automodule:: bfd_test
:members:
:undoc-members:
:show-inheritance:
As the test grows the amount of errors we get on the output increases.
I'm proposing that we create a simple script that finds all directives created by Sphinx from its source, and integrate them at the robot by adding them to docutils when reading source files. The script would generate code that would them be committed as part of robot's source. Would that be a reasonable approach? If so, I can try to provide a PR for it.
Do we need to worry about other reST files directives defined by other tools? Sphinx seems popular enough in the python world, but I'm not really sure.
This is definitely something we should fix somehow. I'm not sure is having a list of ignored directives and roles a good idea, though. We needed to get them from various Sphinx and docutils plugins too, and maintaining the list would be an annoying task.
I'd prefer disabling warnings from all non-existing directives/roles. Did you already investigate is that possible somehow? Should probably ask that on docutils forums. If that's not possible, disabling all warnings might be the next best solution. It could be argued that you see warnings when generating the docs and thus they aren't important when running tests, but it might still be safer to make that configurable.
I've sent a message at the docutils-users list. Taking a quick look at docutils code I tend to say that it does not provide this flexibility about error messages.
Disabling all warnings is not enough as unknown directives/roles are considered errors. An option to disable all errors sound strong. Looks like there is a severe message type as well, tough.
One could argue that if you do not use that file to compile docs you should not use it to run tests.
Activity
pekkaklarck commentedon Aug 10, 2015
This is definitely something we should fix somehow. I'm not sure is having a list of ignored directives and roles a good idea, though. We needed to get them from various Sphinx and docutils plugins too, and maintaining the list would be an annoying task.
I'd prefer disabling warnings from all non-existing directives/roles. Did you already investigate is that possible somehow? Should probably ask that on docutils forums. If that's not possible, disabling all warnings might be the next best solution. It could be argued that you see warnings when generating the docs and thus they aren't important when running tests, but it might still be safer to make that configurable.
vkruoso commentedon Aug 11, 2015
I've sent a message at the docutils-users list. Taking a quick look at docutils code I tend to say that it does not provide this flexibility about error messages.
Disabling all warnings is not enough as unknown directives/roles are considered errors. An option to disable all errors sound strong. Looks like there is a
severemessage type as well, tough.One could argue that if you do not use that file to compile docs you should not use it to run tests.
Docs and tests for supressing docutils errors/warnings with reST form…