Commit Graph

4336 Commits

Author SHA1 Message Date
Adam Turner
44326fe247 Remove tests that rely on setuptools 2023-03-05 19:03:06 +00:00
Adam Turner
43e681e88f Remove `.egg support from pycode ModuleAnalyser`
Python eggs are a now-obsolete binary distribution format.
2023-03-05 19:03:06 +00:00
Adam Turner
f435fc05e6 Prefer `contextlib.chdir to sphinx.util.osutil.cd` 2023-03-05 18:49:17 +00:00
Adam Turner
c5641702b5 Update tests for Babel 2.12 (CLDR 42) 2023-03-05 13:32:37 +00:00
Adam Turner
18f8c0bfc8 Resolve lint errors from Ruff 0.0.254 2023-03-05 12:54:24 +00:00
Adam Turner
4804390604 Resolve `flake8-return` errors 2023-02-18 02:16:50 +00:00
Adam Turner
6c56988979 Unescape quotation marks where possible 2023-02-18 02:16:50 +00:00
Adam Turner
13442f6901 Fix pytest style issues 2023-02-18 02:16:50 +00:00
Adam Turner
dc1a519a1d Avoid `unittest.TestCase` methods 2023-02-18 02:05:14 +00:00
Adam Turner
f6435a9bc3 Prefer `@pytest.fixture()` 2023-02-18 01:58:05 +00:00
Adam Turner
c8f4a03dac Fix COM812 2023-02-18 01:58:05 +00:00
Jeremy Maitin-Shepard
8de6638697 Add `content_offset parameter to nested_parse_with_titles` (#11147)
Previously, ``nested_parse_with_titles`` always passed ``0`` as the input
offset when invoking ``nested_parse``.  When parsing the content of a
directive, as is a common use case for ``nested_parse_with_titles``,
this leads to incorrect source file/line number information, as it
does not take into account the directive's ``content_offset``, which is
always non-zero.

This issue affects *all* object descriptions due to GH-10887.  It also
affects the ``sphinx.ext.ifconfig`` extension.

The ``py:module`` and ``js:module`` directives employed a workaround for
this issue, by wrapping the calls to ``nested_parse_with_title`` with
``switch_source_input``.  That worked, but was more complicated (and
likely less efficient) than necessary.

This commit adds an optional ``content_offset`` parameter to
``nested_parse_with_titles``, and fixes callers to pass the appropriate
content offset when needed.

This commit eliminates the now-unnecessary calls to
``switch_source_input`` and instead specifies the correct ``content_offset``.
2023-02-15 05:45:28 +00:00
Jeremy Maitin-Shepard
44684e1654 Restore correct parallel search index building (#11192)
Revert b32841e153
to fix parallel search index building

The image-related changes were already reverted in
2a7c40d07f,
but the search index changes also need to be reverted.

It would be nice to support parallel search index building, but the
necessary support for merging the search indices produced by each
process needs to be added first.
2023-02-15 05:26:10 +00:00
Adam Turner
c17300aa7a Treat Python warnings as errors during testing 2023-02-15 04:34:10 +00:00
Adam Turner
bd4684f483 Fix Ruff bidirectional text errors 2023-02-11 13:17:18 +00:00
Jean Abou-Samra
ecfd08d325 Skip sphinx.locale.init_console when running tests (#11159)
Tests for Sphinx's CLIs, like test_apidoc, indirectly init_console to
initialize translations for Sphinx's console domain, the one with
Sphinx's log messages. This bleeds over subsequent tests by making
warnings translated. Fix this by skipping init_console when running
Sphinx's test suite.
2023-01-31 22:10:48 +00:00
Adam Turner
4c4745af9c Fix various Ruff errors 2023-01-31 18:30:43 +00:00
Jean-François B
0fcd359663 Update test_config.py::test_needs_sphinx for Alabaster 0.7.13 compat
Relates #11145
2023-01-21 11:11:03 +01:00
Adam Turner
e17f39e7b5 Merge branch '6.1.x'
# Conflicts:
#	CHANGES
#	sphinx/__init__.py
2023-01-10 16:00:59 +00:00
Adam Turner
2a7c40d07f Undo parallel image changes 2023-01-10 14:53:17 +00:00
Jean-François B
19b0710944 Fix #11079 (LaTeX: figure with align disappears if not followed by text) 2023-01-08 19:40:24 +01:00
Adam Turner
a13cf2c24d Adopt `profile = "black" for isort`
This allows using Ruff's import sorting fixers
2023-01-07 18:31:15 +00:00
Adam Turner
a1cd19e601 Fix copying images under parallel execution (#11100) 2023-01-07 17:35:21 +00:00
Jean-François B
7945aeb22d LaTeX: fix 5.1.0 bugs related to topic and contents boxes (#11102)
* Fix #11095 (PDF wrong placement of shadow of topic boxes since 5.1.0)

* Fix #11096 (LaTeX shadowsize regression at 5.1.0)

* Fix #11099 (shadowrule legacy sphinxsetup key vanished at 5.1.0)

* Fix #11101 (LaTeX div.topic_padding of sphinxsetup had wrong name)

* Add some checks that various sphinxsetup keys do not break PDF build

* Update LaTeX docs

* Update CHANGES

* Can not use :dudir:`contents` has it links to wrong place
2023-01-06 23:52:19 +01:00
Adam Turner
476c115b0e Suppress `ValueError in apply_source_workaround` (#11092) 2023-01-05 16:56:27 +00:00
Adam Turner
a9b0f2708b Cache doctrees more efficiently 2023-01-04 05:46:23 +00:00
Adam Turner
f4ab9adf77 Move XML Name pattern to `epub3` 2023-01-03 22:36:54 +00:00
Adam Turner
8c5e7013ea Move console output utilities to `sphinx.util.display`
- Merge `old_status_iterator` into ``status_iterator``.
  ``old_status_iterator`` was deprecated in version 1.6.
2023-01-03 18:37:20 +00:00
Jean-François B
bfd95dadf2 Fix #6744: support for seealso directive should be via an environment 2023-01-03 18:58:39 +01:00
Adam Turner
29e12ec4db Document `typing.NewType` as a class (#10700) 2023-01-02 18:57:04 +00:00
Adam Turner
77a02cf696 Use PEP 604 display for `typing.Optional and typing.Union` (#11072) 2023-01-02 17:49:18 +00:00
Adam Turner
087522cf79 Rewrite IndexBuilder loading 2023-01-02 17:40:38 +00:00
Adam Turner
4032070e81 Run pyupgrade (#11070) 2023-01-02 00:01:14 +00:00
Rotzbua
ede68fa423 Remove obsolete HTML keyword `link rel="shortcut"` (#11069)
The link relationship keyword `shortcut` does not appear in the HTML 5 specification [1].

It was used by historic browsers (i.e. Internet Explorer 6) which Sphinx no longer supports.

[1]: HTML5 Specification, 4.6.7.8 Link type "icon", https://html.spec.whatwg.org/#rel-icon
2023-01-01 22:18:13 +00:00
Adam Turner
f4c8a0a68e Insert `from __future__ import annotations` 2023-01-01 20:48:37 +00:00
Adam Turner
a1c10f5d5e Happy New Year! 2023-01-01 19:40:01 +00:00
Adam Turner
a6257fc83b Make copyright text inclusion test date-independent
Improve clarity on what the test is looking for in the footer
2023-01-01 19:38:55 +00:00
Adam Turner
1e900a26e8 Merge branch '6.0.x' 2023-01-01 19:17:24 +00:00
Adam Turner
965768bfda Fix tests for Pygments 2.14
Pygments 2.14 was released on 01/01/2023 [0]

[0]: https://pygments.org/docs/changelog/#version-2-14-0
2023-01-01 19:17:03 +00:00
Adam Turner
aeda313430 Reflect changes to `Enum` signature in Python 3.12 2022-12-30 18:11:52 +00:00
John Gardner
28d184c0d6 Add test for multi-word key names (`kbd` role) (#10765) 2022-12-30 00:57:51 +00:00
Adam Turner
bf06d7ef4d Factor out HTML 4 translator (#11051)
Move the HTML 4 translator into a private module.
2022-12-30 00:53:04 +00:00
Adam Turner
b91f6617ed Enable Ruff's pylint 'PLC2201' check
Address all cases where the comparison order check is violated
2022-12-30 00:06:11 +00:00
Adam Turner
7fb45a9058 Enable Ruff's flake8-bandit checks 2022-12-29 23:53:48 +00:00
Adam Turner
b5357774a7 Enable Ruff's pylint checks
Also fix two PLW0602 warnings (``global`` without assignment) and
five PLW0120 warnings (else clause on loop without break).
2022-12-29 23:53:48 +00:00
Adam Turner
8634fbce60 Adopt the Ruff code linting tool
https://github.com/charliermarsh/ruff
2022-12-29 17:00:27 +00:00
James Addison
041e5f8268 Add test coverage for 'today_fmt' reference substitution (#10980) 2022-12-29 14:19:43 +00:00
Daniel Eades
1abb24e309 remove blanket 'noqas' 2022-12-16 16:50:24 +01:00
Jean-François B
7418d2ccc4 Deactivate (provisorily) Python12-dev testing (#11035)
* fix flake8 warnings

* Deactivate (provisorily) testing with 3.12-dev

(refs:
https://github.com/sphinx-doc/sphinx/pull/10995#issuecomment-1330310586
)

* Escape # in tox.ini for tox 4 compatibility ('du-latest' tests)

Co-authored-by: Daniel Eades <danieleades@hotmail.com>
2022-12-16 12:41:54 +01:00
Adam Turner
920828fe35 Run the `pyupgrade` tool 2022-10-17 22:39:09 +01:00