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

3.27.0: pytest is failing in tests/test_basic.py units with deprecation errors #38

Open
kloczek opened this issue Jul 19, 2023 · 6 comments

Comments

@kloczek
Copy link

kloczek commented Jul 19, 2023

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix> using 'installer` module
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-moderncmakedomain-3.27.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-moderncmakedomain-3.27.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.17, pytest-7.4.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/moderncmakedomain-3.27.0
configfile: pyproject.toml
testpaths: tests
collected 4 items

tests/test_basic.py EEE                                                                                                                                                               [ 75%]
tests/test_version.py .                                                                                                                                                               [100%]

========================================================================================== ERRORS ===========================================================================================
___________________________________________________________________________ ERROR at setup of test_simple_html[0] ___________________________________________________________________________

test_params = {'shared_result': None}
app_params = app_params(args=['html'], kwargs={'freshenv': True, 'confoverrides': {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}, 'srcdir': path('/tmp/pytest-of-tkloczko/pytest-71/root')})
make_app = <function make_app.<locals>.make at 0x7f5525a635e0>, shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7f5525a4f7c0>

    @pytest.fixture(scope='function')
    def app(test_params: dict, app_params: tuple[dict, dict], make_app: Callable,
            shared_result: SharedResult) -> Generator[SphinxTestApp, None, None]:
        """
        Provides the 'sphinx.application.Sphinx' object
        """
        args, kwargs = app_params
>       app_ = make_app(*args, **kwargs)

app_params = app_params(args=['html'], kwargs={'freshenv': True, 'confoverrides': {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}, 'srcdir': path('/tmp/pytest-of-tkloczko/pytest-71/root')})
args       = ['html']
kwargs     = {'confoverrides': {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}, 'freshenv': True, 'srcdir': path('/tmp/pytest-of-tkloczko/pytest-71/root')}
make_app   = <function make_app.<locals>.make at 0x7f5525a635e0>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7f5525a4f7c0>
test_params = {'shared_result': None}

/usr/lib/python3.8/site-packages/sphinx/testing/fixtures.py:132:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/sphinx/testing/fixtures.py:178: in make
    app_: Any = SphinxTestApp(*args, **kwargs)
        apps       = []
        args       = ('html',)
        kwargs     = {'confoverrides': {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}, 'freshenv': True, 'srcdir': path('/tmp/pytest-of-tkloczko/pytest-71/root'), 'status': <_io.StringIO object at 0x7f5525a63700>, ...}
        status     = <_io.StringIO object at 0x7f5525a63700>
        test_params = {'shared_result': None}
        warning    = <_io.StringIO object at 0x7f5525a63790>
/usr/lib/python3.8/site-packages/sphinx/testing/util.py:138: in __init__
    super().__init__(srcdir, confdir, outdir, doctreedir,
        __class__  = <class 'sphinx.testing.util.SphinxTestApp'>
        builddir   = path('/tmp/pytest-of-tkloczko/pytest-71/root/_build')
        buildername = 'html'
        confdir    = path('/tmp/pytest-of-tkloczko/pytest-71/root')
        confoverrides = {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}
        doctreedir = path('/tmp/pytest-of-tkloczko/pytest-71/root/_build/doctrees')
        docutilsconf = None
        freshenv   = True
        outdir     = path('/tmp/pytest-of-tkloczko/pytest-71/root/_build/html')
        parallel   = 0
        self       = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f5525a4fd30>
        srcdir     = path('/tmp/pytest-of-tkloczko/pytest-71/root')
        status     = <_io.StringIO object at 0x7f5525a63700>
        tags       = None
        warning    = <_io.StringIO object at 0x7f5525a63790>
        warningiserror = False
/usr/lib/python3.8/site-packages/sphinx/application.py:225: in __init__
    self.setup_extension(extension)
        buildername = 'html'
        confdir    = path('/tmp/pytest-of-tkloczko/pytest-71/root')
        confoverrides = {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}
        doctreedir = path('/tmp/pytest-of-tkloczko/pytest-71/root/_build/doctrees')
        extension  = 'sphinxcontrib.htmlhelp'
        freshenv   = True
        keep_going = False
        outdir     = path('/tmp/pytest-of-tkloczko/pytest-71/root/_build/html')
        parallel   = 0
        pdb        = False
        self       = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f5525a4fd30>
        srcdir     = path('/tmp/pytest-of-tkloczko/pytest-71/root')
        status     = <_io.StringIO object at 0x7f5525a63700>
        tags       = None
        verbosity  = 0
        warning    = <_io.StringIO object at 0x7f5525a63790>
        warningiserror = False
/usr/lib/python3.8/site-packages/sphinx/application.py:404: in setup_extension
    self.registry.load_extension(self, extname)
        extname    = 'sphinxcontrib.htmlhelp'
        self       = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f5525a4fd30>
/usr/lib/python3.8/site-packages/sphinx/registry.py:442: in load_extension
    mod = import_module(extname)
        app        = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f5525a4fd30>
        extname    = 'sphinxcontrib.htmlhelp'
        prefix     = 'while setting up extension sphinxcontrib.htmlhelp:'
        self       = <sphinx.registry.SphinxComponentRegistry object at 0x7f5525a4fdc0>
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
        level      = 0
        name       = 'sphinxcontrib.htmlhelp'
        package    = None
/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp/__init__.py:26: in <module>
    from sphinx.util import progress_message
        Any        = typing.Any
        Config     = <class 'sphinx.config.Config'>
        Dict       = typing.Dict
        Element    = <class 'docutils.nodes.Element'>
        IndexEntries = <class 'sphinx.environment.adapters.indexentries.IndexEntries'>
        List       = typing.List
        Node       = <class 'docutils.nodes.Node'>
        Set        = typing.Set
        Sphinx     = <class 'sphinx.application.Sphinx'>
        StandaloneHTMLBuilder = <class 'sphinx.builders.html.StandaloneHTMLBuilder'>
        Tuple      = typing.Tuple
        Type       = typing.Type
        __builtins__ = <builtins>
        __cached__ = '/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp/__pycache__/__init__.cpython-38.pyc'
        __doc__    = '\n    sphinxcontrib.htmlhelp\n    ~~~~~~~~~~~~~~~~~~~~~~\n\n    Build HTML help support files.\n\n    :copyright: Copyright 2007-2019 by the Sphinx team, see README.\n    :license: BSD, see LICENSE for details.\n'
        __file__   = '/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp/__init__.py'
        __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x7f5525087e80>
        __name__   = 'sphinxcontrib.htmlhelp'
        __package__ = 'sphinxcontrib.htmlhelp'
        __path__   = ['/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp']
        __spec__   = ModuleSpec(name='sphinxcontrib.htmlhelp', loader=<_frozen_importlib_external.SourceFileLoader object at 0x7f5525087e80...xcontrib/htmlhelp/__init__.py', submodule_search_locations=['/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp'])
        __warningregistry__ = {'version': 33}
        addnodes   = <module 'sphinx.addnodes' from '/usr/lib/python3.8/site-packages/sphinx/addnodes.py'>
        document   = <class 'docutils.nodes.document'>
        get_translation = <function get_translation at 0x7f55263e5670>
        html       = <module 'html' from '/usr/lib64/python3.8/html/__init__.py'>
        logging    = <module 'sphinx.util.logging' from '/usr/lib/python3.8/site-packages/sphinx/util/logging.py'>
        nodes      = <module 'docutils.nodes' from '/usr/lib/python3.8/site-packages/docutils/nodes.py'>
        os         = <module 'os' from '/usr/lib64/python3.8/os.py'>
        path       = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>
/usr/lib/python3.8/site-packages/sphinx/util/__init__.py:408: in __getattr__
    _deprecation_warning(__name__, name, canonical_name, remove=(8, 0))
        _deprecation_warning = <function _deprecation_warning at 0x7f55266b4a60>
        canonical_name = 'sphinx.http_date.epoch_to_rfc1123'
        deprecated_object = <class 'sphinx.util.display.progress_message'>
        name       = 'progress_message'
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

module = 'sphinx.util', attribute = 'progress_message', canonical_name = 'sphinx.http_date.epoch_to_rfc1123'

    def _deprecation_warning(
        module: str,
        attribute: str,
        canonical_name: str,
        *,
        remove: tuple[int, int],
    ) -> None:
        """Helper function for module-level deprecations using __getattr__

        Exemplar usage:

        .. code:: python

           # deprecated name -> (object to return, canonical path or empty string)
           _DEPRECATED_OBJECTS = {
               'deprecated_name': (object_to_return, 'fully_qualified_replacement_name'),
           }


           def __getattr__(name):
               if name not in _DEPRECATED_OBJECTS:
                   raise AttributeError(f'module {__name__!r} has no attribute {name!r}')

               from sphinx.deprecation import _deprecation_warning

               deprecated_object, canonical_name = _DEPRECATED_OBJECTS[name]
               _deprecation_warning(__name__, name, canonical_name, remove=(7, 0))
               return deprecated_object
        """

        if remove == (7, 0):
            warning_class: type[Warning] = RemovedInSphinx70Warning
        elif remove == (8, 0):
            warning_class = RemovedInSphinx80Warning
        else:
            raise RuntimeError(f'removal version {remove!r} is invalid!')

        qualified_name = f'{module}.{attribute}'
        if canonical_name:
            message = (f'The alias {qualified_name!r} is deprecated, '
                       f'use {canonical_name!r} instead.')
        else:
            message = f'{qualified_name!r} is deprecated.'

>       warnings.warn(message + " Check CHANGES for Sphinx API modifications.",
                      warning_class, stacklevel=3)
E       sphinx.deprecation.RemovedInSphinx80Warning: The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.http_date.epoch_to_rfc1123' instead. Check CHANGES for Sphinx API modifications.

attribute  = 'progress_message'
canonical_name = 'sphinx.http_date.epoch_to_rfc1123'
message    = "The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.http_date.epoch_to_rfc1123' instead."
module     = 'sphinx.util'
qualified_name = 'sphinx.util.progress_message'
remove     = (8, 0)
warning_class = <class 'sphinx.deprecation.RemovedInSphinx80Warning'>

/usr/lib/python3.8/site-packages/sphinx/deprecation.py:63: RemovedInSphinx80Warning
___________________________________________________________________________ ERROR at setup of test_simple_html[1] ___________________________________________________________________________

test_params = {'shared_result': None}
app_params = app_params(args=['html'], kwargs={'freshenv': True, 'confoverrides': {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}, 'srcdir': path('/tmp/pytest-of-tkloczko/pytest-71/root')})
make_app = <function make_app.<locals>.make at 0x7f5524f0d8b0>, shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7f5524f05b50>

    @pytest.fixture(scope='function')
    def app(test_params: dict, app_params: tuple[dict, dict], make_app: Callable,
            shared_result: SharedResult) -> Generator[SphinxTestApp, None, None]:
        """
        Provides the 'sphinx.application.Sphinx' object
        """
        args, kwargs = app_params
>       app_ = make_app(*args, **kwargs)

app_params = app_params(args=['html'], kwargs={'freshenv': True, 'confoverrides': {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}, 'srcdir': path('/tmp/pytest-of-tkloczko/pytest-71/root')})
args       = ['html']
kwargs     = {'confoverrides': {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}, 'freshenv': True, 'srcdir': path('/tmp/pytest-of-tkloczko/pytest-71/root')}
make_app   = <function make_app.<locals>.make at 0x7f5524f0d8b0>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7f5524f05b50>
test_params = {'shared_result': None}

/usr/lib/python3.8/site-packages/sphinx/testing/fixtures.py:132:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/sphinx/testing/fixtures.py:178: in make
    app_: Any = SphinxTestApp(*args, **kwargs)
        apps       = []
        args       = ('html',)
        kwargs     = {'confoverrides': {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}, 'freshenv': True, 'srcdir': path('/tmp/pytest-of-tkloczko/pytest-71/root'), 'status': <_io.StringIO object at 0x7f5524f0d9d0>, ...}
        status     = <_io.StringIO object at 0x7f5524f0d9d0>
        test_params = {'shared_result': None}
        warning    = <_io.StringIO object at 0x7f5524f0da60>
/usr/lib/python3.8/site-packages/sphinx/testing/util.py:138: in __init__
    super().__init__(srcdir, confdir, outdir, doctreedir,
        __class__  = <class 'sphinx.testing.util.SphinxTestApp'>
        builddir   = path('/tmp/pytest-of-tkloczko/pytest-71/root/_build')
        buildername = 'html'
        confdir    = path('/tmp/pytest-of-tkloczko/pytest-71/root')
        confoverrides = {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}
        doctreedir = path('/tmp/pytest-of-tkloczko/pytest-71/root/_build/doctrees')
        docutilsconf = None
        freshenv   = True
        outdir     = path('/tmp/pytest-of-tkloczko/pytest-71/root/_build/html')
        parallel   = 0
        self       = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f5524f056d0>
        srcdir     = path('/tmp/pytest-of-tkloczko/pytest-71/root')
        status     = <_io.StringIO object at 0x7f5524f0d9d0>
        tags       = None
        warning    = <_io.StringIO object at 0x7f5524f0da60>
        warningiserror = False
/usr/lib/python3.8/site-packages/sphinx/application.py:225: in __init__
    self.setup_extension(extension)
        buildername = 'html'
        confdir    = path('/tmp/pytest-of-tkloczko/pytest-71/root')
        confoverrides = {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}
        doctreedir = path('/tmp/pytest-of-tkloczko/pytest-71/root/_build/doctrees')
        extension  = 'sphinxcontrib.htmlhelp'
        freshenv   = True
        keep_going = False
        outdir     = path('/tmp/pytest-of-tkloczko/pytest-71/root/_build/html')
        parallel   = 0
        pdb        = False
        self       = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f5524f056d0>
        srcdir     = path('/tmp/pytest-of-tkloczko/pytest-71/root')
        status     = <_io.StringIO object at 0x7f5524f0d9d0>
        tags       = None
        verbosity  = 0
        warning    = <_io.StringIO object at 0x7f5524f0da60>
        warningiserror = False
/usr/lib/python3.8/site-packages/sphinx/application.py:404: in setup_extension
    self.registry.load_extension(self, extname)
        extname    = 'sphinxcontrib.htmlhelp'
        self       = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f5524f056d0>
/usr/lib/python3.8/site-packages/sphinx/registry.py:442: in load_extension
    mod = import_module(extname)
        app        = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f5524f056d0>
        extname    = 'sphinxcontrib.htmlhelp'
        prefix     = 'while setting up extension sphinxcontrib.htmlhelp:'
        self       = <sphinx.registry.SphinxComponentRegistry object at 0x7f5524f05670>
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
        level      = 0
        name       = 'sphinxcontrib.htmlhelp'
        package    = None
/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp/__init__.py:26: in <module>
    from sphinx.util import progress_message
        Any        = typing.Any
        Config     = <class 'sphinx.config.Config'>
        Dict       = typing.Dict
        Element    = <class 'docutils.nodes.Element'>
        IndexEntries = <class 'sphinx.environment.adapters.indexentries.IndexEntries'>
        List       = typing.List
        Node       = <class 'docutils.nodes.Node'>
        Set        = typing.Set
        Sphinx     = <class 'sphinx.application.Sphinx'>
        StandaloneHTMLBuilder = <class 'sphinx.builders.html.StandaloneHTMLBuilder'>
        Tuple      = typing.Tuple
        Type       = typing.Type
        __builtins__ = <builtins>
        __cached__ = '/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp/__pycache__/__init__.cpython-38.pyc'
        __doc__    = '\n    sphinxcontrib.htmlhelp\n    ~~~~~~~~~~~~~~~~~~~~~~\n\n    Build HTML help support files.\n\n    :copyright: Copyright 2007-2019 by the Sphinx team, see README.\n    :license: BSD, see LICENSE for details.\n'
        __file__   = '/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp/__init__.py'
        __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x7f5524eb47f0>
        __name__   = 'sphinxcontrib.htmlhelp'
        __package__ = 'sphinxcontrib.htmlhelp'
        __path__   = ['/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp']
        __spec__   = ModuleSpec(name='sphinxcontrib.htmlhelp', loader=<_frozen_importlib_external.SourceFileLoader object at 0x7f5524eb47f0...xcontrib/htmlhelp/__init__.py', submodule_search_locations=['/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp'])
        __warningregistry__ = {'version': 66}
        addnodes   = <module 'sphinx.addnodes' from '/usr/lib/python3.8/site-packages/sphinx/addnodes.py'>
        document   = <class 'docutils.nodes.document'>
        get_translation = <function get_translation at 0x7f55263e5670>
        html       = <module 'html' from '/usr/lib64/python3.8/html/__init__.py'>
        logging    = <module 'sphinx.util.logging' from '/usr/lib/python3.8/site-packages/sphinx/util/logging.py'>
        nodes      = <module 'docutils.nodes' from '/usr/lib/python3.8/site-packages/docutils/nodes.py'>
        os         = <module 'os' from '/usr/lib64/python3.8/os.py'>
        path       = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>
/usr/lib/python3.8/site-packages/sphinx/util/__init__.py:408: in __getattr__
    _deprecation_warning(__name__, name, canonical_name, remove=(8, 0))
        _deprecation_warning = <function _deprecation_warning at 0x7f55266b4a60>
        canonical_name = 'sphinx.http_date.epoch_to_rfc1123'
        deprecated_object = <class 'sphinx.util.display.progress_message'>
        name       = 'progress_message'
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

module = 'sphinx.util', attribute = 'progress_message', canonical_name = 'sphinx.http_date.epoch_to_rfc1123'

    def _deprecation_warning(
        module: str,
        attribute: str,
        canonical_name: str,
        *,
        remove: tuple[int, int],
    ) -> None:
        """Helper function for module-level deprecations using __getattr__

        Exemplar usage:

        .. code:: python

           # deprecated name -> (object to return, canonical path or empty string)
           _DEPRECATED_OBJECTS = {
               'deprecated_name': (object_to_return, 'fully_qualified_replacement_name'),
           }


           def __getattr__(name):
               if name not in _DEPRECATED_OBJECTS:
                   raise AttributeError(f'module {__name__!r} has no attribute {name!r}')

               from sphinx.deprecation import _deprecation_warning

               deprecated_object, canonical_name = _DEPRECATED_OBJECTS[name]
               _deprecation_warning(__name__, name, canonical_name, remove=(7, 0))
               return deprecated_object
        """

        if remove == (7, 0):
            warning_class: type[Warning] = RemovedInSphinx70Warning
        elif remove == (8, 0):
            warning_class = RemovedInSphinx80Warning
        else:
            raise RuntimeError(f'removal version {remove!r} is invalid!')

        qualified_name = f'{module}.{attribute}'
        if canonical_name:
            message = (f'The alias {qualified_name!r} is deprecated, '
                       f'use {canonical_name!r} instead.')
        else:
            message = f'{qualified_name!r} is deprecated.'

>       warnings.warn(message + " Check CHANGES for Sphinx API modifications.",
                      warning_class, stacklevel=3)
E       sphinx.deprecation.RemovedInSphinx80Warning: The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.http_date.epoch_to_rfc1123' instead. Check CHANGES for Sphinx API modifications.

attribute  = 'progress_message'
canonical_name = 'sphinx.http_date.epoch_to_rfc1123'
message    = "The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.http_date.epoch_to_rfc1123' instead."
module     = 'sphinx.util'
qualified_name = 'sphinx.util.progress_message'
remove     = (8, 0)
warning_class = <class 'sphinx.deprecation.RemovedInSphinx80Warning'>

/usr/lib/python3.8/site-packages/sphinx/deprecation.py:63: RemovedInSphinx80Warning
___________________________________________________________________________ ERROR at setup of test_simple_html[2] ___________________________________________________________________________

test_params = {'shared_result': None}
app_params = app_params(args=['html'], kwargs={'freshenv': True, 'confoverrides': {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}, 'srcdir': path('/tmp/pytest-of-tkloczko/pytest-71/root')})
make_app = <function make_app.<locals>.make at 0x7f55259ceaf0>, shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7f5524f99520>

    @pytest.fixture(scope='function')
    def app(test_params: dict, app_params: tuple[dict, dict], make_app: Callable,
            shared_result: SharedResult) -> Generator[SphinxTestApp, None, None]:
        """
        Provides the 'sphinx.application.Sphinx' object
        """
        args, kwargs = app_params
>       app_ = make_app(*args, **kwargs)

app_params = app_params(args=['html'], kwargs={'freshenv': True, 'confoverrides': {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}, 'srcdir': path('/tmp/pytest-of-tkloczko/pytest-71/root')})
args       = ['html']
kwargs     = {'confoverrides': {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}, 'freshenv': True, 'srcdir': path('/tmp/pytest-of-tkloczko/pytest-71/root')}
make_app   = <function make_app.<locals>.make at 0x7f55259ceaf0>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7f5524f99520>
test_params = {'shared_result': None}

/usr/lib/python3.8/site-packages/sphinx/testing/fixtures.py:132:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/sphinx/testing/fixtures.py:178: in make
    app_: Any = SphinxTestApp(*args, **kwargs)
        apps       = []
        args       = ('html',)
        kwargs     = {'confoverrides': {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}, 'freshenv': True, 'srcdir': path('/tmp/pytest-of-tkloczko/pytest-71/root'), 'status': <_io.StringIO object at 0x7f5525a63040>, ...}
        status     = <_io.StringIO object at 0x7f5525a63040>
        test_params = {'shared_result': None}
        warning    = <_io.StringIO object at 0x7f5525a63790>
/usr/lib/python3.8/site-packages/sphinx/testing/util.py:138: in __init__
    super().__init__(srcdir, confdir, outdir, doctreedir,
        __class__  = <class 'sphinx.testing.util.SphinxTestApp'>
        builddir   = path('/tmp/pytest-of-tkloczko/pytest-71/root/_build')
        buildername = 'html'
        confdir    = path('/tmp/pytest-of-tkloczko/pytest-71/root')
        confoverrides = {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}
        doctreedir = path('/tmp/pytest-of-tkloczko/pytest-71/root/_build/doctrees')
        docutilsconf = None
        freshenv   = True
        outdir     = path('/tmp/pytest-of-tkloczko/pytest-71/root/_build/html')
        parallel   = 0
        self       = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f5524ec03a0>
        srcdir     = path('/tmp/pytest-of-tkloczko/pytest-71/root')
        status     = <_io.StringIO object at 0x7f5525a63040>
        tags       = None
        warning    = <_io.StringIO object at 0x7f5525a63790>
        warningiserror = False
/usr/lib/python3.8/site-packages/sphinx/application.py:225: in __init__
    self.setup_extension(extension)
        buildername = 'html'
        confdir    = path('/tmp/pytest-of-tkloczko/pytest-71/root')
        confoverrides = {'html_baseurl': 'https://example.org/docs/', 'language': 'en'}
        doctreedir = path('/tmp/pytest-of-tkloczko/pytest-71/root/_build/doctrees')
        extension  = 'sphinxcontrib.htmlhelp'
        freshenv   = True
        keep_going = False
        outdir     = path('/tmp/pytest-of-tkloczko/pytest-71/root/_build/html')
        parallel   = 0
        pdb        = False
        self       = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f5524ec03a0>
        srcdir     = path('/tmp/pytest-of-tkloczko/pytest-71/root')
        status     = <_io.StringIO object at 0x7f5525a63040>
        tags       = None
        verbosity  = 0
        warning    = <_io.StringIO object at 0x7f5525a63790>
        warningiserror = False
/usr/lib/python3.8/site-packages/sphinx/application.py:404: in setup_extension
    self.registry.load_extension(self, extname)
        extname    = 'sphinxcontrib.htmlhelp'
        self       = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f5524ec03a0>
/usr/lib/python3.8/site-packages/sphinx/registry.py:442: in load_extension
    mod = import_module(extname)
        app        = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f5524ec03a0>
        extname    = 'sphinxcontrib.htmlhelp'
        prefix     = 'while setting up extension sphinxcontrib.htmlhelp:'
        self       = <sphinx.registry.SphinxComponentRegistry object at 0x7f5524ec04f0>
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
        level      = 0
        name       = 'sphinxcontrib.htmlhelp'
        package    = None
/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp/__init__.py:26: in <module>
    from sphinx.util import progress_message
        Any        = typing.Any
        Config     = <class 'sphinx.config.Config'>
        Dict       = typing.Dict
        Element    = <class 'docutils.nodes.Element'>
        IndexEntries = <class 'sphinx.environment.adapters.indexentries.IndexEntries'>
        List       = typing.List
        Node       = <class 'docutils.nodes.Node'>
        Set        = typing.Set
        Sphinx     = <class 'sphinx.application.Sphinx'>
        StandaloneHTMLBuilder = <class 'sphinx.builders.html.StandaloneHTMLBuilder'>
        Tuple      = typing.Tuple
        Type       = typing.Type
        __builtins__ = <builtins>
        __cached__ = '/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp/__pycache__/__init__.cpython-38.pyc'
        __doc__    = '\n    sphinxcontrib.htmlhelp\n    ~~~~~~~~~~~~~~~~~~~~~~\n\n    Build HTML help support files.\n\n    :copyright: Copyright 2007-2019 by the Sphinx team, see README.\n    :license: BSD, see LICENSE for details.\n'
        __file__   = '/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp/__init__.py'
        __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x7f5524e67be0>
        __name__   = 'sphinxcontrib.htmlhelp'
        __package__ = 'sphinxcontrib.htmlhelp'
        __path__   = ['/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp']
        __spec__   = ModuleSpec(name='sphinxcontrib.htmlhelp', loader=<_frozen_importlib_external.SourceFileLoader object at 0x7f5524e67be0...xcontrib/htmlhelp/__init__.py', submodule_search_locations=['/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp'])
        __warningregistry__ = {'version': 99}
        addnodes   = <module 'sphinx.addnodes' from '/usr/lib/python3.8/site-packages/sphinx/addnodes.py'>
        document   = <class 'docutils.nodes.document'>
        get_translation = <function get_translation at 0x7f55263e5670>
        html       = <module 'html' from '/usr/lib64/python3.8/html/__init__.py'>
        logging    = <module 'sphinx.util.logging' from '/usr/lib/python3.8/site-packages/sphinx/util/logging.py'>
        nodes      = <module 'docutils.nodes' from '/usr/lib/python3.8/site-packages/docutils/nodes.py'>
        os         = <module 'os' from '/usr/lib64/python3.8/os.py'>
        path       = <module 'posixpath' from '/usr/lib64/python3.8/posixpath.py'>
/usr/lib/python3.8/site-packages/sphinx/util/__init__.py:408: in __getattr__
    _deprecation_warning(__name__, name, canonical_name, remove=(8, 0))
        _deprecation_warning = <function _deprecation_warning at 0x7f55266b4a60>
        canonical_name = 'sphinx.http_date.epoch_to_rfc1123'
        deprecated_object = <class 'sphinx.util.display.progress_message'>
        name       = 'progress_message'
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

module = 'sphinx.util', attribute = 'progress_message', canonical_name = 'sphinx.http_date.epoch_to_rfc1123'

    def _deprecation_warning(
        module: str,
        attribute: str,
        canonical_name: str,
        *,
        remove: tuple[int, int],
    ) -> None:
        """Helper function for module-level deprecations using __getattr__

        Exemplar usage:

        .. code:: python

           # deprecated name -> (object to return, canonical path or empty string)
           _DEPRECATED_OBJECTS = {
               'deprecated_name': (object_to_return, 'fully_qualified_replacement_name'),
           }


           def __getattr__(name):
               if name not in _DEPRECATED_OBJECTS:
                   raise AttributeError(f'module {__name__!r} has no attribute {name!r}')

               from sphinx.deprecation import _deprecation_warning

               deprecated_object, canonical_name = _DEPRECATED_OBJECTS[name]
               _deprecation_warning(__name__, name, canonical_name, remove=(7, 0))
               return deprecated_object
        """

        if remove == (7, 0):
            warning_class: type[Warning] = RemovedInSphinx70Warning
        elif remove == (8, 0):
            warning_class = RemovedInSphinx80Warning
        else:
            raise RuntimeError(f'removal version {remove!r} is invalid!')

        qualified_name = f'{module}.{attribute}'
        if canonical_name:
            message = (f'The alias {qualified_name!r} is deprecated, '
                       f'use {canonical_name!r} instead.')
        else:
            message = f'{qualified_name!r} is deprecated.'

>       warnings.warn(message + " Check CHANGES for Sphinx API modifications.",
                      warning_class, stacklevel=3)
E       sphinx.deprecation.RemovedInSphinx80Warning: The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.http_date.epoch_to_rfc1123' instead. Check CHANGES for Sphinx API modifications.

attribute  = 'progress_message'
canonical_name = 'sphinx.http_date.epoch_to_rfc1123'
message    = "The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.http_date.epoch_to_rfc1123' instead."
module     = 'sphinx.util'
qualified_name = 'sphinx.util.progress_message'
remove     = (8, 0)
warning_class = <class 'sphinx.deprecation.RemovedInSphinx80Warning'>

/usr/lib/python3.8/site-packages/sphinx/deprecation.py:63: RemovedInSphinx80Warning
================================================================================== short test summary info ==================================================================================
ERROR tests/test_basic.py::test_simple_html[0] - sphinx.deprecation.RemovedInSphinx80Warning: The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.http_date.epoch_to_rfc1123' instead. Check CHANGES for Sphinx API modif...
ERROR tests/test_basic.py::test_simple_html[1] - sphinx.deprecation.RemovedInSphinx80Warning: The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.http_date.epoch_to_rfc1123' instead. Check CHANGES for Sphinx API modif...
ERROR tests/test_basic.py::test_simple_html[2] - sphinx.deprecation.RemovedInSphinx80Warning: The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.http_date.epoch_to_rfc1123' instead. Check CHANGES for Sphinx API modif...
================================================================================ 1 passed, 3 errors in 0.54s ================================================================================

Here is list of installed modules in build env

Package                       Version
----------------------------- --------
alabaster                     0.7.13
asttokens                     2.2.1
Babel                         2.12.1
backcall                      0.2.0
build                         0.10.0
charset-normalizer            3.1.0
decorator                     5.1.1
distro                        1.8.0
docutils                      0.19
editables                     0.4
exceptiongroup                1.1.1
executing                     1.2.0
gpg                           1.20.0
hatchling                     1.18.0
idna                          3.4
imagesize                     1.4.1
importlib-metadata            6.7.0
iniconfig                     2.0.0
installer                     0.7.0
ipython                       8.12.0
jedi                          0.18.2
Jinja2                        3.1.2
libcomps                      0.1.19
MarkupSafe                    2.1.2
matplotlib-inline             0.1.6
packaging                     23.1
parso                         0.8.3
pathspec                      0.11.1
pexpect                       4.8.0
pickleshare                   0.7.5
pluggy                        1.0.0
prompt-toolkit                3.0.38
ptyprocess                    0.7.0
pure-eval                     0.2.2
Pygments                      2.15.1
pyproject_hooks               1.0.0
pytest                        7.4.0
python-dateutil               2.8.2
pytz                          2023.2
requests                      2.31.0
setuptools                    68.0.0
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        6.2.1
sphinxcontrib-applehelp       1.0.4
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
stack-data                    0.6.2
tomli                         2.0.1
traitlets                     5.9.0
trove-classifiers             2023.7.6
typing_extensions             4.7.1
urllib3                       1.26.15
wcwidth                       0.2.6
wheel                         0.40.0
zipp                          3.15.0
@LecrisUT
Copy link

LecrisUT commented Jul 31, 2023

Interesting @henryiii, are the latest sphinx versions not pulled in the CI? This seems like an upstream/dependency issue, but I'm surprised it was not picked up in the CI.

@kloczek Can you test with different versions of sphinx? From the traceback it looks like it's a sphinx specific deprecation, although the tests could be relaxed on this package side to not error on deprecation outside of the CI environment.

@kloczek
Copy link
Author

kloczek commented Jul 31, 2023

I'm using sphinx with +50% of all my packages

[tkloczko@pers-jacek SPECS]$ grep ^%sphinx_build_man python-* | wc -l; ls -1 python-*|wc -l
605
1174

to generate module documentation as man page.
I've tested that many modules still is not ready for sphinx 7.x. About 70 modules from above 605 have some issues when sphinx 7.1.0 was (which usually means that those modules needs to be updated). I've tested that 3 weeks ago so until I'll not at least flag those issues to maintainers I'm holding sphinx upgrade to 7.x.

It would require check some past build logs from my build infra however IIRC your module had similar pytest issues with sphinx 7.x however as I wrote I'm not ATM 100% and cannot check that today.

@LecrisUT
Copy link

@kloczek Try it out locally on your system with only different sphinx version. The CI does not say which sphinx version it is using: https://github.com/scikit-build/moderncmakedomain/actions/runs/5594294188/job/15153138220, and the traceback indicates that the deprecation warning is coming from sphinx or sphinxcontrib-htmlhelp. So try looking there for updates.

But these are also only deprecation warnings, which should only be in the CI, so until that is changed, you can try to manually add that to the ignored warnings:

"ignore::DeprecationWarning:sphinx.builders.gettext",
.

@henryiii
Copy link
Contributor

henryiii commented Jul 31, 2023

Looks like sphinx is loading all extensions that are installed, and you've got one that's not updated. It's not modernsphinxdomain's fault (we don't use this method at all), it's only a problem with turning on warnings as errors.

The modules we depend on are fine, AFAICT. But if you install other ones (sphinxcontrib.htmlhelp, for example), then Sphinx will produce warnings that become errors when it's loading all entry points. I'm guessing you have one large environment with lots of things installed instead of one just for this package?

You can manually ignore there errors there with -W ignore:..., or (better) report the warning to that package.

@kloczek
Copy link
Author

kloczek commented Jul 31, 2023

I'm guessing you have one large environment with lots of things installed instead of one just for this package?

No I have per rpm package build spawned build env in which are only installed only packages listed in rpm BuildRequires (and its dependencies).
In this case list of BuildRequires looks like below:

BuildRequires:  python3dist(build)
BuildRequires:  python3dist(hatchling)
BuildRequires:  python3dist(installer)
BuildRequires:  python3dist(wheel)
# ChcekRequires:
BuildRequires:  python3dist(docutils)
BuildRequires:  python3dist(pygments)
BuildRequires:  python3dist(pytest)
BuildRequires:  python3dist(setuptools)
BuildRequires:  python3dist(sphinx)

FYI: setuptools is on that list because 9d267a2.

@henryiii
Copy link
Contributor

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

3 participants