Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sphinx 7.2 breaks trait documenter tests #1754

Closed
mdickinson opened this issue Sep 5, 2023 · 4 comments · Fixed by #1755
Closed

Sphinx 7.2 breaks trait documenter tests #1754

mdickinson opened this issue Sep 5, 2023 · 4 comments · Fixed by #1755
Labels
component: trait-documenter Issues related to the trait-documenter Sphinx extension type: bug

Comments

@mdickinson
Copy link
Member

It looks as though recent versions of Sphinx have broken the Traits documenter extension. Our "Test installation from PyPI" job has had recent runs with Sphinx 7.1.2 (which passed), and with Sphinx 7.2.2 (which failed).

Here are the test failures:

======================================================================
ERROR: test_abbreviated_annotations (traits.util.tests.test_trait_documenter.TestTraitDocumenter.test_abbreviated_annotations)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/traits/util/tests/test_trait_documenter.py", line 147, in test_abbreviated_annotations
    with self.create_directive() as directive:
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/traits/util/tests/test_trait_documenter.py", line 226, in create_directive
    app = SphinxTestApp(srcdir=path(tmpdir))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/sphinx/testing/util.py", line 105, in __init__
    outdir.mkdir(parents=True, exist_ok=True)
    ^^^^^^^^^^^^
AttributeError: 'path' object has no attribute 'mkdir'

======================================================================
ERROR: test_can_document_member (traits.util.tests.test_trait_documenter.TestTraitDocumenter.test_can_document_member)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/traits/util/tests/test_trait_documenter.py", line 177, in test_can_document_member
    with self.create_directive() as directive:
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/traits/util/tests/test_trait_documenter.py", line 226, in create_directive
    app = SphinxTestApp(srcdir=path(tmpdir))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/sphinx/testing/util.py", line 105, in __init__
    outdir.mkdir(parents=True, exist_ok=True)
    ^^^^^^^^^^^^
AttributeError: 'path' object has no attribute 'mkdir'

----------------------------------------------------------------------
@mdickinson mdickinson added type: bug component: trait-documenter Issues related to the trait-documenter Sphinx extension labels Sep 5, 2023
@mdickinson
Copy link
Member Author

See also this job with Sphinx 7.2.5, which failed similarly.

@mdickinson
Copy link
Member Author

Related, but not quite the same issue: sphinx-doc/sphinx#11605

@mdickinson
Copy link
Member Author

Also: sphinx-doc/sphinx#11526

@mdickinson mdickinson changed the title Sphinx 7.2 breaks trait documenter Sphinx 7.2 breaks trait documenter tests Sep 5, 2023
@mdickinson
Copy link
Member Author

It looks as though it's only the test that's broken, not the Trait documenter itself. I've updated the issue title accordingly.

mdickinson added a commit that referenced this issue Sep 11, 2023
This PR fixes the Trait documenter test for Sphinx >= 7.2. For that
version of Sphinx, the `srcdir` argument to `SphinxTestApp` needs to be
a `pathlib.Path` object rather than a `sphinx.testing.path.path` object.

Closes #1754
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: trait-documenter Issues related to the trait-documenter Sphinx extension type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant