Commit Graph

148 Commits

Author SHA1 Message Date
jakkdl e1e1874cda rename AbstractMatcher -> AbstractRaises, Matcher->RaisesExc. Add docs on RaisesGroup&RaisesExc. Add warnings to group_contains. Remove group_contains example from getting-started page 2025-02-06 15:39:25 +01:00
Shaygan Hooshyari ecde993e17
fixtures: replace fixture representation with a class (#12473)
During the sprint we discussed fixing the above issue and thought maybe it's a better idea to add a better representation to fixtures. To do this without patching the object more, this PR refactors fixtures to have a class with attributes.

The main rational behind that is:

- Now we have a type for fixtures makes it easier to check for fixture types and no need to perform cast on objects. Removed monkey patching.

- They are no longer functions that carry a class within them.

- When you decorate a function with a fixture it's not possible to call it anymore. So it makes more sense for it to not be a function or method.

Fixes #11525

---------

Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
Co-authored-by: Ran Benita <ran@unusedvar.com>
2024-12-07 08:51:26 -03:00
Pradyun Gedam cc9bf0097d Improve how the documentation sidebar is managed
Move away from injecting unstyled HTML into the sidebar, to using
Furo's default sidebar with Sphinx's `doctree` instead.

This also includes moving to a more typical Sphinx documentation
structure with the `index` page serving as the "root" of the `doctree`
for Sphinx.

Additionally, move custom stylesheets into a `pytest-custom.css` file
and use standard Sphinx tooling to inject these styles.
2024-07-09 21:59:27 +03:00
Pradyun Gedam 05979bc4a9 Modernise Sphinx configuration
This change brings the configuration closer with what the latest
sphinx-quickstart generates. It also makes it easier to read through the
documentation configuration file as well.

- Remove unset configuration options
- Drop configuration options that are set to their default values
- Remove placeholder comments, including inline documentation of options
- Group configuration options into sections with links to detailed docs
- Move all custom logic toward the end of the file
2024-07-09 21:59:27 +03:00
Sviatoslav Sydorenko 29e4b6b9f0
📝🔥 Remove the `:bpo:` RST role declaration
BPO is in read-only mode and all issues have been migrated to GitHub.
This patch replaces the use of that role with `:issue:`, recently
integrated via #12522. It also disables the built-in `extlinks` Sphinx
extension, as it's no longer in use.
2024-06-26 14:19:13 +02:00
Sviatoslav Sydorenko 8f2ef30f4a
🚑 Stop setting PR/issue prefix @ `sphinx-issues`
Apparently, the extension only supports one of the pre-defined
prefixes.
2024-06-22 22:16:40 +02:00
Sviatoslav Sydorenko b919a711a4
📝 Replace GH/PyPI `extlinks` w/ `sphinx_issues`
This extension implements more generic roles that can also be used
more flexibly. Relying on an external extension allows to stop
maintaining an in-repo copy of the commonly used behavior.
2024-06-22 22:11:43 +02:00
Sviatoslav Sydorenko 66dbab697b
📝 Rename `:pull:` RST role to `:pr:`
This is a preparatory patch for integrating the third party
`sphinx-issues` extension.
2024-06-22 21:54:45 +02:00
Ronny Pfannschmidt 5e1649f59a resolve most sphinx lookup errors
add the extra sphinx annotations to refer to Path instances

add Path to nitpicky ignore
2024-06-20 11:04:33 +02:00
Ronny Pfannschmidt 9295f9ffff RFC: from __future__ import annotations + migrate 2024-06-20 11:03:03 +02:00
Sviatoslav Sydorenko e702079fd5
📝💅 Always render changelog draft @ Sphinx docs
The earlier implementation was generating a temporary file, when
the docs site was being built with `tox`. However, this was not
enabled in RTD and is hackish.
This patch integrates the `sphinxcontrib-towncrier` extension to
make it work in any environment where Sphinx docs are being built.
2024-06-20 10:44:32 +02:00
James Frost 020db7ec04
Add html_baseurl to sphinx conf.py (#12364)
This is used to set the <link rel="canonical" href="X"> tag that points to the canonical version of the webpage. Including this indicates to search engines which version to include in their indexes, and should prevent older versions showing up.

Fixes #12363
2024-05-26 07:21:30 -03:00
Sam Jirovec cbf6bd9dd2
Issue #12290 - Docs using Furo Theme W/ Dark Mode (#12326)
* furo theme for docs site

* removing duplicate tocs from deprecations and reference pages

* removing pallets references in code and config

* reverting trainings to sidebar

* removed sphinx style and unpinned packaging version

* updated styles
2024-05-21 13:56:18 +00:00
Pierre Sassoulas 4788165e69 [ruff UP031] Fix to use format specifiers instead of percent format 2024-04-30 18:06:26 +02:00
Tobias Stoeckmann 2e5da5d2fb
doc: fix typos (#12118)
* doc: add missing word

* doc: fix typos

Typos found with codespell
2024-03-14 16:36:11 +00:00
Bruno Oliveira 303cd0d48a Revert "Remove deprecated py.path (`fspath`) node constructor arguments"
This reverts commit 6c89f9261c.
2024-03-07 19:50:33 -03:00
Pierre Sassoulas 4588653b24 Migrate from autoflake, black, isort, pyupgrade, flake8 and pydocstyle, to ruff
ruff is faster and handle everything we had prior.

isort configuration done based on the indication from
https://github.com/astral-sh/ruff/issues/4670, previousely based on
reorder-python-import (#11896)

flake8-docstrings was a wrapper around pydocstyle (now archived) that
explicitly asks to use ruff in https://github.com/PyCQA/pydocstyle/pull/658.

flake8-typing-import is useful mainly for project that support python 3.7
and the one useful check will be implemented in https://github.com/astral-sh/ruff/issues/2302

We need to keep blacken-doc because ruff does not handle detection
of python code inside .md and .rst. The direct link to the repo is
now used to avoid a redirection.

Manual fixes:
- Lines that became too long
- % formatting that was not done automatically
- type: ignore that were moved around
- noqa of hard to fix issues (UP031 generally)
- fmt: off and fmt: on that is not really identical
  between black and ruff
- autofix re-order in pre-commit from faster to slower

Co-authored-by: Ran Benita <ran@unusedvar.com>
2024-02-02 09:27:00 +01:00
Bruno Oliveira 8b54596639 Run pre-commit on all files
Running pre-commit on all files after replacing reorder-python-imports by isort.
2024-01-30 16:35:46 -03:00
Ran Benita 6c89f9261c Remove deprecated py.path (`fspath`) node constructor arguments 2024-01-03 14:29:45 +02:00
Ran Benita 2aa8743bbe doc: enable Sphinx nitpicky mode
See:
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-nitpicky

This ensures we have no more broken references.
2023-12-07 12:14:45 +02:00
Zac Hatfield-Dodds f4e3b4ad98 Drop Python 3.7 2023-06-30 14:55:42 -07:00
Ville Skyttä 6041511fb4
Spelling and grammar fixes (#11014) 2023-05-18 10:10:44 -03:00
Philipp A 245a8c23dd
Revamp good practices (#10206)
* Recommend importlib import mode for new projects
* Recommend src layout more strongly
* Switch to hatchling as the packaging tool in the example (following PyPA)
* Add explanation about the different import modes
2022-09-01 07:55:41 -03:00
Ran Benita 7431750bb6 doc: have tighter control on what autodoc shows
New versions of sphinx starting showing `__init__` parameters even when
we don't want them to show because they are private (have `_ispytest`
argument).

The only working solution I found was to switch to
`autodoc_typehints_description_target = "documented"` and explicitly
document parameters for which we want to show the types. It's a little
tedious and repetitive in some simple cases, but overall it results in
nicer API docs.
2022-08-13 21:46:49 +03:00
Ran Benita cb7f5ed3b1 doc: require sphinx 5
Fix #9836.
2022-08-13 21:45:54 +03:00
pre-commit-ci[bot] cba65e74b3 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-06-22 15:32:05 +00:00
Sandro Tosi fe2c74cb1a
Update location of `usage.rst` to fix manpage compilation
`usage.rst` has been moved from `doc/en` to `doc/en/how-to`, so the `man_pages` configuration
value needs to be updated to the new location, so that we dont get this warning:

    writing... WARNING: "man_pages" config value references unknown document usage
2022-06-07 14:43:34 -04:00
Tim Hoffmann 9a9acf13f8
Declutter doc entry page (#9969)
- Remove the index page https://docs.pytest.org/en/7.1.x/genindex.html
  Such an index is reasonable in books but not so much in HTML pages.
  IMHO the integrated search is much more user-friendly and sufficient.

- Remove the PDF link from the entry page. The PDF is already linked
  in the sidebar. I anticipate that getting the PDF documentation is
  not a major concern for users.

- Remove the sections "Changelog" and "License" from the entry page.
  These section only contain links to the respective pages.
  These topics are purely technical. They should be easily accessible
  (which they still are through sidebar section "About the project"),
  but they don't need additional advertisement through a dedicated
  section on the entry page.
2022-05-24 10:23:39 +02:00
Ran Benita 1612d3d1af doc: remove django intersphinx mapping
Initially I just wanted to fix http -> https, but I think it's not worth
having at all just for this one reference.
2022-02-08 00:46:20 +02:00
Ran Benita 0e69c62ece doc: add a `hook` crossref type
Allow writing

    🪝`pytest_cmdline_main`

instead of

    :func:`pytest_cmdline_main <_pytest.hookspec.pytest_cmdline_main>`
2021-12-12 16:29:30 +02:00
Bruno Oliveira ed24f29e60 Change copyright notice so yearly updates are not needed
Just learned that we don't need to do this every year: https://hynek.me/til/copyright-years

Followed Go's example of only stating the starting year: https://github.com/golang/go/blob/master/LICENSE

Btw any ideas why the dates vary? Some start in 2004, others 2013, 2015... shouldn't be the same year for all locations?
2021-11-30 09:28:23 -03:00
oleg.hoefling 2f1096cd55
replace hardcoded links to github user profiles with extlinks
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-11-10 20:47:27 +01:00
Bruno Oliveira b378f9a6e0
Merge pull request #9276 from hoefling/doc/extlinks-bpo 2021-11-08 09:41:26 -03:00
oleg.hoefling 16e15b99ae
sphinx 3 compat
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-11-07 15:24:57 +01:00
oleg.hoefling 36265ccbf6
replace hardcoded links to bugs.python.org with extlinks
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-11-07 15:24:57 +01:00
oleg.hoefling bba0ce4877
replace hardcoded links to github pull requests with extlinks
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-11-07 15:18:36 +01:00
Oleg Höfling 49f934618c
Replace hardcoded links to Github issues with extlinks (#9234) 2021-11-06 11:16:11 +02:00
Ran Benita a53abe93d8
Merge pull request #9208 from bluetech/legacypath-plugin
Add legacypath plugin, move py.path stuff there
2021-11-02 20:35:12 +02:00
andrewdotn 1824349f74
Use Ubuntu 20.04, lualatex for readthedocs builds (#9242) 2021-10-30 11:21:14 -03:00
Ran Benita 1df28a4450 Move testdir to legacypath plugin 2021-10-28 21:51:51 +03:00
Oleg Höfling 1e9e16d829
Replace hardcoded links to PyPI with extlinks (#9224) 2021-10-22 09:47:57 -03:00
Bruno Oliveira 5fc7b21391
Use xelatex engine for better Unicode support (#9197) 2021-10-12 10:12:15 -03:00
Bruno Oliveira fb52fc5163
Merge pull request #9070 from andrewdotn/main 2021-10-05 16:51:58 -03:00
oleg.hoefling d58ee2b677
replace hardcoded urls to docs.pytest.org with internal crossrefs, add external crossrefs where possible
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-10-04 00:23:41 +02:00
Andrew Neitsch a9edfdf9db Run black on conf.py 2021-09-02 20:42:29 -06:00
Andrew Neitsch b46d5f4657 Only use inkscapeconverter if inkscape installed 2021-09-02 20:40:17 -06:00
Andrew Neitsch e929d15848 Include figures in PDF docs
The PDF documentation on readthedocs was missing the figures in the
fixtures reference chapter. This PR uses a Sphinx plugin that
automatically converts the checked-in SVG files to the PDF input files
that LaTeX requires.

The SVG-to-PDF conversion is done by inkscape, which gave the best
conversion among the tools I tried. However, it [does not yet
understand][href-bug] that you can write a plain `href` instead of
`xlink:href` in svg files, so I’ve had to edit the SVG files
accordingly.

[href-bug]: https://github.com/TeX-Live/luatex.git
2021-09-02 17:40:41 -06:00
oleg.hoefling d1aea7d7a8
use intersphinx crossrefs to stdlib docs where possible instead of hardcoded URLs
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-08-26 16:05:03 +02:00
Saiprasad Kale 6b53714d57
Update conf.py 2021-05-08 23:43:33 +05:30
Nico Schlömer 9ef608ef76
"fix" a couple of http -> https redirects
Found with
urli-fix . -a http: -i pytest
2021-04-26 17:44:27 +02:00