Commit Graph

4352 Commits

Author SHA1 Message Date
Martin Liška
fc4fead40d Allow parallel execution of tests in `test_search` (#11292)
Add various ``app.builder.build_all()`` calls.
2023-04-05 13:54:09 +01:00
Martin Liška
8e26d78b79 Remove hidden state from `test_nosearch` (#11291)
Currently, ``test_nosearch`` depends on ``html_search_language='de'``
from a previous test and thus fails if run individually.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-04-05 13:43:24 +01:00
Adam Turner
4a3febb69a Add an option for displaying short `Literal` types (#11109)
The new ``python_display_short_literal_types`` configuration option
for the ``py`` domain controls display of PEP 586 ``Literal`` types.
The 'short' format is inspired by PEP 604, using the bitwise OR operator
to distinguish the possible legal values for the argument.
2023-04-05 13:07:25 +01:00
Jean-François B
126737c3cd Add unit test for issue #11110 as fixed by #11113 2023-04-03 18:26:34 +02:00
Jean-François B
89a4cdb673 Let the #11276 test actually be one which would have failed earlier 2023-03-31 19:27:54 +02:00
Adam Turner
15553da9c8 Resolve lint errors from Ruff 0.0.260 2023-03-31 17:52:51 +01:00
Jean-François B
8f6ad4a3e5 Fix #11274: external links may break PDF build if under \sphinxupquote 2023-03-31 18:19:35 +02:00
Dimitri Papadopoulos
669bcc0a19 Fix typos found by codespell 2023-03-27 07:22:07 +02:00
Jean-François B
a7949d4290 LaTeX: let mark-up for seealso directive use explicit colon (fix #11264) 2023-03-26 23:57:04 +02:00
Adam Turner
7d928b3e79 Increase `test_linkcheck` timeouts 2023-03-24 01:07:25 +00:00
Adam Turner
97f07ca83c Speed up `test_linkcheck` 2023-03-24 00:29:27 +00:00
Adam Turner
9df3b59e00 Resolve lint errors from Ruff 0.0.259 2023-03-23 21:58:49 +00:00
Adam Turner
3d2114214b Improve static typing in `intersphinx` et al 2023-03-17 17:43:23 +00:00
Adam Turner
2902c6c55b Deprecate legacy `intersphinx_mapping` format (#11247)
This format was made obsolete in Sphinx 1.0, but never formally deprecated.
2023-03-17 16:41:22 +00:00
Jeremy Maitin-Shepard
7a4ce71f6b Include source in highlighting warnings (#11150)
If pygments fails to lex a source string as the specified highlight
language, Sphinx prints a warning.  Previously, that warning did not
include the actual source text, although it does include location
information.

However, in some cases the location information may be missing, there
may be multiple highlighted literals on the same line, or the rST is
automatically generated somehow.  In such cases, it can be difficult
to determine the source text that led to the error.

With this change, the source text is included in the warning.
2023-03-17 15:32:27 +00:00
Adam Turner
29d7166af2 Drop OrderedDict
Since Python 3.7, dicts maintain insertion order.
2023-03-05 19:03:06 +00:00
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