Skip to content

Test failures if Sphinx is not installed #3063

@hiker

Description

@hiker

If sphinx is not installed, I get several test failures:

FAILED docstring_parser_test.py::test_create_docstring_data - assert "<class 'int'>" == 'int'
FAILED psyGen_test.py::test_transformation_get_valid_options - assert "<class 'bool'>" == 'bool'

10 test failures all in all (some are slightly different, but all seem to involve some type). At least two cases have been confirmed to be caused by missing sphinx, e.g. in psyGen.py:

try:
    from sphinx.util.typing import stringify_annotation
except ImportError:
    # No Sphinx available so use our own, simpler version.
    from psyclone.utils import stringify_annotation

So, without Sphinx, stringify_annotation is different, and the output of stringify_annotation is just different when sphinx is not available.

IMHO, the best approach might be in all tests to disable import of sphinx during testing, not sure if this is possible. So, we might adjust tests to be:

    assert options['valid2'].typename in ["int", "<class 'int'>"]

Of course, we might also make sphinx a requirement? It seems to be reasonable big (all sphinx* package on my system is >30MB))
Or we could try to make our stringify_annotation to be more similar to Sphinx's :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions