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

Test suite does not pass against Sphinx 7.2.6 #975

Open
gareth-rees opened this issue Mar 31, 2024 · 0 comments
Open

Test suite does not pass against Sphinx 7.2.6 #975

gareth-rees opened this issue Mar 31, 2024 · 0 comments

Comments

@gareth-rees
Copy link

Running the Breathe test suite (as of commit 542ae9b) against Sphinx 7.2.6, all the tests in test_renderer.py fail with an error like this:

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80a7add0>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80a83040>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'
Complete output from `make dev-test`
make dev-test
cd tests && PYTHONPATH=../: python3 -m pytest -v
======================================== test session starts ========================================
platform linux -- Python 3.10.13, pytest-7.4.4, pluggy-1.4.0 -- /home/grees/venv3.10/bin/python3
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase(PosixPath('/home/grees/github.com/breathe/tests/.hypothesis/examples'))
rootdir: /home/grees/github.com/breathe
plugins: xdist-3.5.0, hypothesis-6.99.11, forked-1.6.0, antilru-1.1.1, subprocess-1.5.0
collected 21 items                                                                                  

test_renderer.py::test_find_nodes PASSED                                                      [  4%]
test_renderer.py::test_find_node PASSED                                                       [  9%]
test_renderer.py::test_render_func ERROR                                                      [ 14%]
test_renderer.py::test_render_typedef ERROR                                                   [ 19%]
test_renderer.py::test_render_c_typedef ERROR                                                 [ 23%]
test_renderer.py::test_render_c_function_typedef ERROR                                        [ 28%]
test_renderer.py::test_render_using_alias ERROR                                               [ 33%]
test_renderer.py::test_render_const_func ERROR                                                [ 38%]
test_renderer.py::test_render_lvalue_func ERROR                                               [ 42%]
test_renderer.py::test_render_rvalue_func ERROR                                               [ 47%]
test_renderer.py::test_render_const_lvalue_func ERROR                                         [ 52%]
test_renderer.py::test_render_const_rvalue_func ERROR                                         [ 57%]
test_renderer.py::test_render_variable_initializer ERROR                                      [ 61%]
test_renderer.py::test_render_define_initializer ERROR                                        [ 66%]
test_renderer.py::test_render_define_no_initializer ERROR                                     [ 71%]
test_renderer.py::test_render_innergroup ERROR                                                [ 76%]
test_renderer.py::test_resolve_overrides ERROR                                                [ 80%]
test_renderer.py::test_ellipsis ERROR                                                         [ 85%]
test_utils.py::TestUtils::test_definition_without_template_args PASSED                        [ 90%]
test_utils.py::TestUtils::test_param_decl PASSED                                              [ 95%]
test_utils.py::TestPathHandler::test_path_handler PASSED                                      [100%]

============================================== ERRORS ===============================================
________________________________ ERROR at setup of test_render_func _________________________________

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80a7add0>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80a83040>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'

test_renderer.py:38: AttributeError
_______________________________ ERROR at setup of test_render_typedef _______________________________

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80a7a560>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80a828c0>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'

test_renderer.py:38: AttributeError
______________________________ ERROR at setup of test_render_c_typedef ______________________________

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80ac2cb0>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80a831f0>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'

test_renderer.py:38: AttributeError
_________________________ ERROR at setup of test_render_c_function_typedef __________________________

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80ac2050>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80af8e50>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'

test_renderer.py:38: AttributeError
_____________________________ ERROR at setup of test_render_using_alias _____________________________

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80ac3250>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80af8d90>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'

test_renderer.py:38: AttributeError
_____________________________ ERROR at setup of test_render_const_func ______________________________

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80ac2950>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80afb670>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'

test_renderer.py:38: AttributeError
_____________________________ ERROR at setup of test_render_lvalue_func _____________________________

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80ac2d40>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80af9d80>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'

test_renderer.py:38: AttributeError
_____________________________ ERROR at setup of test_render_rvalue_func _____________________________

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80ac2f80>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80a83340>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'

test_renderer.py:38: AttributeError
__________________________ ERROR at setup of test_render_const_lvalue_func __________________________

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80ac2680>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80afa830>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'

test_renderer.py:38: AttributeError
__________________________ ERROR at setup of test_render_const_rvalue_func __________________________

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80ac3be0>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80af8790>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'

test_renderer.py:38: AttributeError
________________________ ERROR at setup of test_render_variable_initializer _________________________

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80ac3e20>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80afa530>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'

test_renderer.py:38: AttributeError
_________________________ ERROR at setup of test_render_define_initializer __________________________

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80ac3130>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80af99f0>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'

test_renderer.py:38: AttributeError
________________________ ERROR at setup of test_render_define_no_initializer ________________________

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80ac3d00>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80b026e0>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'

test_renderer.py:38: AttributeError
_____________________________ ERROR at setup of test_render_innergroup ______________________________

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80ac2f80>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80b021a0>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'

test_renderer.py:38: AttributeError
_____________________________ ERROR at setup of test_resolve_overrides ______________________________

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80b48af0>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80b02fb0>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'

test_renderer.py:38: AttributeError
__________________________________ ERROR at setup of test_ellipsis __________________________________

test_params = {'shared_result': None}
app_params = _app_params(args=[], kwargs={'srcdir': PosixPath('/tmp/pytest-of-grees/pytest-2/root')})
make_app = <function make_app.<locals>.make at 0x7fdc80b48310>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7fdc80b031f0>

    @pytest.fixture(scope="function")
    def app(test_params, app_params, make_app, shared_result):
        """
        Based on sphinx.testing.fixtures.app
        """
        args, kwargs = app_params
        assert "srcdir" in kwargs
>       kwargs["srcdir"].makedirs(exist_ok=True)
E       AttributeError: 'PosixPath' object has no attribute 'makedirs'

test_renderer.py:38: AttributeError
========================================= warnings summary ==========================================
test_renderer.py:26
  /home/grees/github.com/breathe/tests/test_renderer.py:26: RemovedInSphinx90Warning: 'sphinx.testing.path' is deprecated. Use 'os.path' or 'pathlib' instead.
    from sphinx.testing.path import path

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
====================================== short test summary info ======================================
ERROR test_renderer.py::test_render_func - AttributeError: 'PosixPath' object has no attribute 'ma...
ERROR test_renderer.py::test_render_typedef - AttributeError: 'PosixPath' object has no attribute ...
ERROR test_renderer.py::test_render_c_typedef - AttributeError: 'PosixPath' object has no attribut...
ERROR test_renderer.py::test_render_c_function_typedef - AttributeError: 'PosixPath' object has no...
ERROR test_renderer.py::test_render_using_alias - AttributeError: 'PosixPath' object has no attrib...
ERROR test_renderer.py::test_render_const_func - AttributeError: 'PosixPath' object has no attribu...
ERROR test_renderer.py::test_render_lvalue_func - AttributeError: 'PosixPath' object has no attrib...
ERROR test_renderer.py::test_render_rvalue_func - AttributeError: 'PosixPath' object has no attrib...
ERROR test_renderer.py::test_render_const_lvalue_func - AttributeError: 'PosixPath' object has no ...
ERROR test_renderer.py::test_render_const_rvalue_func - AttributeError: 'PosixPath' object has no ...
ERROR test_renderer.py::test_render_variable_initializer - AttributeError: 'PosixPath' object has ...
ERROR test_renderer.py::test_render_define_initializer - AttributeError: 'PosixPath' object has no...
ERROR test_renderer.py::test_render_define_no_initializer - AttributeError: 'PosixPath' object has...
ERROR test_renderer.py::test_render_innergroup - AttributeError: 'PosixPath' object has no attribu...
ERROR test_renderer.py::test_resolve_overrides - AttributeError: 'PosixPath' object has no attribu...
ERROR test_renderer.py::test_ellipsis - AttributeError: 'PosixPath' object has no attribute 'maked...
============================== 5 passed, 1 warning, 16 errors in 0.50s ==============================
make: *** [Makefile:35: dev-test] Error 1

When sphinx.testing.path is imported, Sphinx application paths used to belong to the class sphinx.testing.path.path (which has a makedirs method) but now they are ordinary Path objects (which does not). Note also that we get this warning:

RemovedInSphinx90Warning: 'sphinx.testing.path' is deprecated. Use 'os.path' or 'pathlib' instead.

The Sphinx behaviour was changed in pull request sphinx-doc/sphinx#11526 (July 2023).

gareth-rees added a commit to gareth-rees/breathe that referenced this issue Mar 31, 2024
Sphinx was updated in in pull request sphinx-doc/sphinx#11526 (July
2023) so that importing `sphinx.testing.path` no longer causes Sphinx
application paths to belong to the class `sphinx.testing.path.path`,
which has a `makedirs` method.

Instead, Sphinx application paths are now ordinary `Path` objects
which lack this method, so we use `os.makedirs` instead. This is
backwards compatible as `sphinx.testing.path.path` objects are
pathlike and so accepted by `os.makedirs`.

Fixes issue breathe-doc#975.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant