Skip to content

Supress docutils errors/warnings with reST format #2093

Closed

Description

@vkruoso

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.

This has been discussed in the robotframework-users list, and I've also talked about this at the sphinx-dev list (where I'm waiting for more answers). Here are the links for reference:
https://groups.google.com/forum/?hl=pt-BR#!topic/robotframework-users/0V-q3xJgcZI
https://groups.google.com/forum/?hl=pt-BR#!topic/sphinx-dev/97e5xDcfsl8

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.

Activity

  1. pekkaklarck commented on Aug 10, 2015

    @pekkaklarck
    Member

    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.

  2. vkruoso commented on Aug 11, 2015

    @vkruoso
    ContributorAuthor

    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.

  3. added this to the 2.9.2 milestone on Oct 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions