Commit Graph

4392 Commits

Author SHA1 Message Date
James Addison
2b333265cb Add a connection-count measurement to the `linkcheck` tests (#11374) 2023-07-23 16:06:23 +01:00
Adam Turner
aabcda94cf Add more information for the `test_gettext_dont_rebuild_mo` test (#11500) 2023-07-23 00:32:27 +01:00
Adam Turner
d71c781187 Re-structure the `linkcheck` builder (#11499)
Re-organise and re-structure the ``linkcheck`` builder:

- All functions defined within functions are factored out into top-level functions or class methods
- Classes and methods have been re-arranged (Builder, PostTransform, Checker, Worker)
- TLS verification on ``sphinx.util.requests`` has been changed to not pass the ``Config`` object all the way down
- The ``Hyperlink`` object now stores the document path
- ``BuildEnvironment`` and ``Config`` objects are used to extract properties and are not stored as class attributes
2023-07-23 00:01:41 +01:00
James Addison
566e4e74a0 Use HTTP/1.1 in linkcheck test webservers (#11392) 2023-07-22 20:12:32 +01:00
James Addison
bef7fc2e45 Refactor HTTP handlers in `linkcheck` builder tests (#11426) 2023-07-20 22:20:53 +01:00
Adam Turner
ce140e8155 Introduce artificial delay into `test_gettext_dont_rebuild_mo` 2023-07-20 21:51:08 +01:00
James Addison
13720de50c Treat SSL failures as broken links in the linkcheck builder (#11431)
TLS operates at a lower layer than HTTP, and so if there is a TLS-related error from a host,
it seems unlikely that retrying with a different higher-layer protocol request
(HTTP GET instead of HTTP HEAD) could succeed.
We should not make additional HTTP requests that we do not believe will succeed.
2023-07-20 21:38:21 +01:00
James Addison
e45fb5e61b Reduce the lifetime of `response` in the linkcheck builder (#11432)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-07-20 21:14:00 +01:00
Adam Turner
d3c91f9512 Refactor `status_iterator` 2023-05-15 10:43:55 +01:00
Stefanie Molin
e09d02e440 Allow `copyright` to contain multiple entries (#10983)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-05-11 22:43:48 +01:00
TLouf
86b07d4a97 Allow multi-line object description signatures (#11011)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: Jean-François B <2589111+jfbu@users.noreply.github.com>
Co-authored-by: TLouf <loufthomas@gmail.com>
2023-05-11 14:28:57 +01:00
Adam Turner
ae206694e6 html builder: Append CRC32 checksum to asset URIs (#11415) 2023-05-11 05:19:31 +01:00
Adam Turner
706f5f9cc8 Warn on deprecated Python-specific index types (#11412) 2023-05-09 22:57:39 +01:00
James Addison
c9d0933e5d linkcheck: Use context managers for HTTP requests (#11318)
This closes HTTP responses when no content reads are required, as
when requests are made in streaming mode, ``requests`` doesn't know
whether the caller may intend to later read content from a streamed
HTTP response object and holds the socket open.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-05-09 17:09:35 +01:00
Adam Turner
ad473730a3 Remove HTML 4 support (#11385) 2023-04-28 11:32:12 +01:00
Adam Turner
3c4e78e236 Make `locale required in sphinx.util.i18n.format_date()` (#11366) 2023-04-27 01:30:40 +01:00
Adam Turner
973e8fb5cf Remove the deprecated `sphinx.ext.napoleon.iterators` module (#11364) 2023-04-27 01:27:07 +01:00
Adam Turner
2a9e805206 Remove the deprecated Setuptools integration (#11363) 2023-04-27 01:22:04 +01:00
Adam Turner
720f89d1d6 Update test for Alabaster version tuple 2023-04-26 17:24:02 +01:00
Adam Turner
d2aa91f63c Revert the default type of `nitpick_ignore[_regex] to list` 2023-04-25 11:31:57 +01:00
James Addison
59de8d5202 Revert "Support and prefer `.jinja to _t` for static templates (#11165)" (#11329)
This reverts commit 5d13215b58.
2023-04-23 19:06:44 +01:00
Adam Turner
aee3c0ab75 Partially revert "Disable localisation when SOURCE_DATE_EPOCH is set (#10949)" (#11343)
This keeps some of the added tests, and avoids a full revert of ``sphinx.locale``.
2023-04-21 19:04:26 +01:00
Martin Liška
186d596f33 Use `overwrite_file context manager in test_ext_autodoc_configs` (#11320)
The tests modify source files (e.g. index.rst) that are not restored
and thus another test could read an altered source file, it leading
to unexpected test results.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-04-21 02:44:11 +01:00
Martin Liška
77483f2824 Add missing test decorator for `test_util_inspect` (#11321) 2023-04-21 02:22:10 +01:00
James Addison
d8f15c7361 Increase timeout threshold for `linkcheck` tests (#11326) 2023-04-21 02:08:14 +01:00
Bénédikt Tran
e2f66cea49 Update CHANGES for PR #11333 2023-04-18 12:13:20 +02:00
Bénédikt Tran
61576516d4 Fix duplicated labels in TeX output (#11093) 2023-04-17 12:07:32 +02:00
Martin Liska
b6e6805f80 test_build_latex: move output to a separate output dir
Related: #11285
Co-authored-by: Jean-François B <2589111+jfbu@users.noreply.github.com>
2023-04-13 06:15:50 +02:00
Jean-François B
b95fc0e88b Use leaner TeX syntax (follow-up to #11319)
Because it is cool.  And avoids overhead.  Matter of principle.
2023-04-11 20:41:58 +02:00
Jean-François B
509cc4533c LaTeX: get aligned longtable obey current list indent
Fix #11268.

Thanks to @picnixz.
2023-04-11 20:32:31 +02:00
James Addison
5d13215b58 Support and prefer `.jinja to _t` for static templates (#11165)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-04-07 18:07:15 +01:00
James Addison
f82c3c9912 Disable localisation when `SOURCE_DATE_EPOCH` is set (#10949)
This commit disables Sphinx's localisation features when reproducible
builds are requested, as determined by a non-empty SOURCE_DATE_EPOCH_
environment variable.

The `Reproducible Builds`_ project aims to provide confidence to
consumers of packaged software that the artefacts they're downloading
and installing have not been altered by the environment they were
built in, and can be replicated at a later date if required.

Builds of localised documentation using Sphinx currently account for
a large category of reproducible build testing failures, because the
builders intentionally use varying environment locales at build-time.
This can affect the contents of the ``objects.inv`` file.

During investigation, it turned out that many ``gettext``-localised
values (particularly in Python modules under ``sphinx.domains``) were
being translated at module-load-time and would not subsequently be
re-localised.

This creates two unusual effects:

1. Attempting to write a test case to build the same application in
   two different languages was not initially possible, as the
   first-loaded translation catalogue (as found in the 
   ``sphinx.locale.translators`` global variable) would remain in-use
   for subsequent application builds under different locales.

2. Localisation of strings could vary depending on whether the
   relevant modules were loaded before or after the resource
   catalogues were populated.

We fix this by performing all translations lazily so that module
imports can occur in any order and localisation of inventory entries
should occur only when translations of those items are requested.

Localisation can then be disabled by configuring the ``gettext``
language to the ISO-639-3 'undetermined' code (``'und'``), as this
should not have an associated translation catalogue. We also want to
prevent ``gettext`` from  attempting to determine the host's locale
from environment variables (including ``LANGUAGE``).

.. _SOURCE_DATE_EPOCH: https://reproducible-builds.org/docs/source-date-epoch/
.. _Reproducible Builds: https://www.reproducible-builds.org/
2023-04-07 17:49:36 +01:00
Jens Hedegaard Nielsen
3edae68904 autosummary: Support documenting inherited attributes (#10691)
The current implementation of ``import_ivar_by_name`` filters
attributes if the name of the object that the attribute belongs to
does not match the object being documented. However, for inherited
attributes this is not the case. Filtering only on the attribute name
seems to resolve the issue. It is not clear to me if there are any
unwanted sideeffects of this and we should filter on the list of
qualnames for the object and all its super classes (if any).

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-04-06 23:33:43 +01:00
Adam Turner
7ecf037280 Enable 'nit-picky mode' for Sphinx's documentation
Fix several reference errors throughout the documentation and set
``nitpick_ignore`` in ``doc/conf.py``.
2023-04-06 23:11:39 +01:00
picnixz
aba392d87f Support type comments in `PropertyDocumenter` (#11298) 2023-04-06 22:56:17 +01:00
Martin Liška
c1c2d758c9 Fix instability in `test_ext_viewcode` (#11297)
Use ``freshenv`` argument and remove ``outdir`` for one test
as the previous one can leave an unexpected leftover.
2023-04-06 22:40:33 +01:00
Martin Liška
f25a36d056 Fix instability in `test_build_epub` (#11296)
Some tests need ``app.builder.build_all`` in order to have complete rebuild.
2023-04-06 22:33:20 +01:00
Martin Liška
a80e3fd377 Use a shared file-system lock in `create_server` (#11294)
With parallel run of tests, one gets "Address already in use" errors
as all tests attempt to bind to the same port. Fix it with a shared
file-system lock.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-04-06 22:24:49 +01:00
Clément Pinard
9299003d40 Autosummary: Extend `__all__` members to template rendering (#10811)
When ``False``, the ``autosummary_ignore_module_all`` option adds
members to the module's members entry that will be used for autodoc,
but otherwise ignores it. As such, if a class is available in the 
``__all__``, it won't be generated.

This commit aims to extend the ``__all__`` handling not only to
members, but also to corresponding attribute types (function,
classes, exceptions, modules)

The ``imported_members`` option is set to ``True`` if the object has
an ``__all__`` member and ``autosummary_ignore_module_all`` is ``False``
2023-04-06 00:02:37 +01:00
Adam Turner
52a099b7ec Resolve lint errors from Ruff 0.0.261 2023-04-05 14:19:43 +01:00
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