Skip to content

pytest: build_sphinx failing when examples are modified #1174

@ddkohler

Description

@ddkohler

This test fails only when examples are modified (e.g. #1173 ).

tests/docs/_sphinx.py::test_build_docs FAILED                            [ 73%]

My guess is that build_sphinx doesn't render examples unless the files have been modified, so that is why this error is coming up now. I could be wrong.

test fails in fringes_transform.py importing datasets:

WARNING: /home/runner/work/WrightTools/WrightTools/examples/fringes_transform.py failed to execute correctly: Traceback (most recent call last):
  File "/home/runner/work/WrightTools/WrightTools/examples/fringes_transform.py", line 14, in <module>
    p = datasets.PyCMDS.w2_w1_000
        ^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'WrightTools.datasets.PyCMDS' has no attribute 'w2_w1_000'

Seems to be related to special module load conditions in sphinx_build. If I query datasets.PyCMDS.dict, I get items:

dict_items([('__name__', 'WrightTools.datasets.PyCMDS'), ('__doc__', None), ('__package__', 'WrightTools.datasets.PyCMDS'), ('__loader__', <_frozen_importlib_external.NamespaceLoader object at 0x7fe20e02dfd0>), ('__spec__', ModuleSpec(name='WrightTools.datasets.PyCMDS', loader=<_frozen_importlib_external.NamespaceLoader object at 0x7fe20e02dfd0>, submodule_search_locations=_NamespacePath(['/home/runner/work/WrightTools/WrightTools/WrightTools/datasets/PyCMDS']))), ('__file__', None), ('__path__', _NamespacePath(['/home/runner/work/WrightTools/WrightTools/WrightTools/datasets/PyCMDS']))])

Possibly related to our special need to delete the datasets module between runs (see docs/conf.py:sphinx_gallery_conf)

Why does this example fail in particular? All other examples run without issue, including others that use datasets.PyCMDS. It's probably important that PyCMDS.w2_w1_000 is the only dataset used in multiple scripts. The first script that uses it (split.py) runs fine...

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