| 1 |
# |
| 2 |
# pytest documentation build configuration file, created by |
| 3 |
# sphinx-quickstart on Fri Oct 8 17:54:28 2010. |
| 4 |
# |
| 5 |
# This file is execfile()d with the current directory set to its containing dir. |
| 6 |
# |
| 7 |
# Note that not all possible configuration values are present in this |
| 8 |
# autogenerated file. |
| 9 |
# |
| 10 |
# All configuration values have a default; values that are commented out |
| 11 |
# serve to show the default. |
| 12 |
# The version info for the project you're documenting, acts as replacement for |
| 13 |
# |version| and |release|, also used in various other places throughout the |
| 14 |
# built documents. |
| 15 |
# |
| 16 |
# The full version, including alpha/beta/rc tags. |
| 17 |
# The short X.Y version. |
| 18 |
import os |
| 19 |
import shutil |
| 20 |
import sys |
| 21 |
from textwrap import dedent |
| 22 |
from typing import TYPE_CHECKING |
| 23 |
|
| 24 |
from _pytest import __version__ as version |
| 25 |
|
| 26 |
|
| 27 |
if TYPE_CHECKING: |
| 28 |
import sphinx.application |
| 29 |
|
| 30 |
|
| 31 |
release = ".".join(version.split(".")[:2]) |
| 32 |
|
| 33 |
# If extensions (or modules to document with autodoc) are in another directory, |
| 34 |
# add these directories to sys.path here. If the directory is relative to the |
| 35 |
# documentation root, use os.path.abspath to make it absolute, like shown here. |
| 36 |
# sys.path.insert(0, os.path.abspath('.')) |
| 37 |
|
| 38 |
autodoc_member_order = "bysource" |
| 39 |
autodoc_typehints = "description" |
| 40 |
autodoc_typehints_description_target = "documented" |
| 41 |
todo_include_todos = 1 |
| 42 |
|
| 43 |
latex_engine = "lualatex" |
| 44 |
|
| 45 |
latex_elements = { |
| 46 |
"preamble": dedent( |
| 47 |
r""" |
| 48 |
\directlua{ |
| 49 |
luaotfload.add_fallback("fallbacks", { |
| 50 |
"Noto Serif CJK SC:style=Regular;", |
| 51 |
"Symbola:Style=Regular;" |
| 52 |
}) |
| 53 |
} |
| 54 |
|
| 55 |
\setmainfont{FreeSerif}[RawFeature={fallback=fallbacks}] |
| 56 |
""" |
| 57 |
) |
| 58 |
} |
| 59 |
|
| 60 |
# -- General configuration ----------------------------------------------------- |
| 61 |
|
| 62 |
# If your documentation needs a minimal Sphinx version, state it here. |
| 63 |
# needs_sphinx = '1.0' |
| 64 |
|
| 65 |
# Add any Sphinx extension module names here, as strings. They can be extensions |
| 66 |
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. |
| 67 |
extensions = [ |
| 68 |
"pallets_sphinx_themes", |
| 69 |
"pygments_pytest", |
| 70 |
"sphinx.ext.autodoc", |
| 71 |
"sphinx.ext.autosummary", |
| 72 |
"sphinx.ext.extlinks", |
| 73 |
"sphinx.ext.intersphinx", |
| 74 |
"sphinx.ext.todo", |
| 75 |
"sphinx.ext.viewcode", |
| 76 |
"sphinx_removed_in", |
| 77 |
"sphinxcontrib_trio", |
| 78 |
] |
| 79 |
|
| 80 |
# Building PDF docs on readthedocs requires inkscape for svg to pdf |
| 81 |
# conversion. The relevant plugin is not useful for normal HTML builds, but |
| 82 |
# it still raises warnings and fails CI if inkscape is not available. So |
| 83 |
# only use the plugin if inkscape is actually available. |
| 84 |
if shutil.which("inkscape"): |
| 85 |
extensions.append("sphinxcontrib.inkscapeconverter") |
| 86 |
|
| 87 |
# Add any paths that contain templates here, relative to this directory. |
| 88 |
templates_path = ["_templates"] |
| 89 |
|
| 90 |
# The suffix of source filenames. |
| 91 |
source_suffix = ".rst" |
| 92 |
|
| 93 |
# The encoding of source files. |
| 94 |
# source_encoding = 'utf-8-sig' |
| 95 |
|
| 96 |
# The master toctree document. |
| 97 |
master_doc = "contents" |
| 98 |
|
| 99 |
# General information about the project. |
| 100 |
project = "pytest" |
| 101 |
copyright = "2015, holger krekel and pytest-dev team" |
| 102 |
|
| 103 |
|
| 104 |
# The language for content autogenerated by Sphinx. Refer to documentation |
| 105 |
# for a list of supported languages. |
| 106 |
# language = None |
| 107 |
|
| 108 |
# There are two options for replacing |today|: either, you set today to some |
| 109 |
# non-false value, then it is used: |
| 110 |
# today = '' |
| 111 |
# Else, today_fmt is used as the format for a strftime call. |
| 112 |
# today_fmt = '%B %d, %Y' |
| 113 |
|
| 114 |
# List of patterns, relative to source directory, that match files and |
| 115 |
# directories to ignore when looking for source files. |
| 116 |
exclude_patterns = [ |
| 117 |
"_build", |
| 118 |
"naming20.rst", |
| 119 |
"test/*", |
| 120 |
"old_*", |
| 121 |
"*attic*", |
| 122 |
"*/attic*", |
| 123 |
"funcargs.rst", |
| 124 |
"setup.rst", |
| 125 |
"example/remoteinterp.rst", |
| 126 |
] |
| 127 |
|
| 128 |
|
| 129 |
# The reST default role (used for this markup: `text`) to use for all documents. |
| 130 |
default_role = "literal" |
| 131 |
|
| 132 |
# If true, '()' will be appended to :func: etc. cross-reference text. |
| 133 |
# add_function_parentheses = True |
| 134 |
|
| 135 |
# If true, the current module name will be prepended to all description |
| 136 |
# unit titles (such as .. function::). |
| 137 |
add_module_names = False |
| 138 |
|
| 139 |
# If true, sectionauthor and moduleauthor directives will be shown in the |
| 140 |
# output. They are ignored by default. |
| 141 |
# show_authors = False |
| 142 |
|
| 143 |
# The name of the Pygments (syntax highlighting) style to use. |
| 144 |
pygments_style = "sphinx" |
| 145 |
|
| 146 |
|
| 147 |
# A list of ignored prefixes for module index sorting. |
| 148 |
# modindex_common_prefix = [] |
| 149 |
|
| 150 |
# A list of regular expressions that match URIs that should not be checked when |
| 151 |
# doing a linkcheck. |
| 152 |
linkcheck_ignore = [ |
| 153 |
"https://blogs.msdn.microsoft.com/bharry/2017/06/28/testing-in-a-cloud-delivery-cadence/", |
| 154 |
"http://pythontesting.net/framework/pytest-introduction/", |
| 155 |
r"https://github.com/pytest-dev/pytest/issues/\d+", |
| 156 |
r"https://github.com/pytest-dev/pytest/pull/\d+", |
| 157 |
] |
| 158 |
|
| 159 |
# The number of worker threads to use when checking links (default=5). |
| 160 |
linkcheck_workers = 5 |
| 161 |
|
| 162 |
|
| 163 |
_repo = "https://github.com/pytest-dev/pytest" |
| 164 |
extlinks = { |
| 165 |
"bpo": ("https://bugs.python.org/issue%s", "bpo-%s"), |
| 166 |
"pypi": ("https://pypi.org/project/%s/", "%s"), |
| 167 |
"issue": (f"{_repo}/issues/%s", "issue #%s"), |
| 168 |
"pull": (f"{_repo}/pull/%s", "pull request #%s"), |
| 169 |
"user": ("https://github.com/%s", "@%s"), |
| 170 |
} |
| 171 |
|
| 172 |
|
| 173 |
nitpicky = True |
| 174 |
nitpick_ignore = [ |
| 175 |
# TODO (fix in pluggy?) |
| 176 |
("py:class", "HookCaller"), |
| 177 |
("py:class", "HookspecMarker"), |
| 178 |
("py:exc", "PluginValidationError"), |
| 179 |
# Might want to expose/TODO (https://github.com/pytest-dev/pytest/issues/7469) |
| 180 |
("py:class", "ExceptionRepr"), |
| 181 |
("py:class", "Exit"), |
| 182 |
("py:class", "SubRequest"), |
| 183 |
("py:class", "SubRequest"), |
| 184 |
("py:class", "TerminalReporter"), |
| 185 |
("py:class", "_pytest._code.code.TerminalRepr"), |
| 186 |
("py:class", "_pytest.fixtures.FixtureFunctionMarker"), |
| 187 |
("py:class", "_pytest.logging.LogCaptureHandler"), |
| 188 |
("py:class", "_pytest.mark.structures.ParameterSet"), |
| 189 |
# Intentionally undocumented/private |
| 190 |
("py:class", "_pytest._code.code.Traceback"), |
| 191 |
("py:class", "_pytest._py.path.LocalPath"), |
| 192 |
("py:class", "_pytest.capture.CaptureResult"), |
| 193 |
("py:class", "_pytest.compat.NotSetType"), |
| 194 |
("py:class", "_pytest.python.PyCollector"), |
| 195 |
("py:class", "_pytest.python.PyobjMixin"), |
| 196 |
("py:class", "_pytest.python_api.RaisesContext"), |
| 197 |
("py:class", "_pytest.recwarn.WarningsChecker"), |
| 198 |
("py:class", "_pytest.reports.BaseReport"), |
| 199 |
# Undocumented third parties |
| 200 |
("py:class", "_tracing.TagTracerSub"), |
| 201 |
("py:class", "warnings.WarningMessage"), |
| 202 |
# Undocumented type aliases |
| 203 |
("py:class", "LEGACY_PATH"), |
| 204 |
("py:class", "_PluggyPlugin"), |
| 205 |
# TypeVars |
| 206 |
("py:class", "_pytest._code.code.E"), |
| 207 |
("py:class", "_pytest.fixtures.FixtureFunction"), |
| 208 |
("py:class", "_pytest.nodes._NodeType"), |
| 209 |
("py:class", "_pytest.python_api.E"), |
| 210 |
("py:class", "_pytest.recwarn.T"), |
| 211 |
("py:class", "_pytest.runner.TResult"), |
| 212 |
("py:obj", "_pytest.fixtures.FixtureValue"), |
| 213 |
("py:obj", "_pytest.stash.T"), |
| 214 |
] |
| 215 |
|
| 216 |
|
| 217 |
# -- Options for HTML output --------------------------------------------------- |
| 218 |
|
| 219 |
sys.path.append(os.path.abspath("_themes")) |
| 220 |
html_theme_path = ["_themes"] |
| 221 |
|
| 222 |
# The theme to use for HTML and HTML Help pages. See the documentation for |
| 223 |
# a list of builtin themes. |
| 224 |
html_theme = "flask" |
| 225 |
|
| 226 |
# Theme options are theme-specific and customize the look and feel of a theme |
| 227 |
# further. For a list of options available for each theme, see the |
| 228 |
# documentation. |
| 229 |
# html_theme_options = {"index_logo": None} |
| 230 |
|
| 231 |
# Add any paths that contain custom themes here, relative to this directory. |
| 232 |
# html_theme_path = [] |
| 233 |
|
| 234 |
# The name for this set of Sphinx documents. If None, it defaults to |
| 235 |
# "<project> v<release> documentation". |
| 236 |
html_title = "pytest documentation" |
| 237 |
|
| 238 |
# A shorter title for the navigation bar. Default is the same as html_title. |
| 239 |
html_short_title = "pytest-%s" % release |
| 240 |
|
| 241 |
# The name of an image file (relative to this directory) to place at the top |
| 242 |
# of the sidebar. |
| 243 |
html_logo = "img/pytest_logo_curves.svg" |
| 244 |
|
| 245 |
# The name of an image file (within the static path) to use as favicon of the |
| 246 |
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 |
| 247 |
# pixels large. |
| 248 |
html_favicon = "img/favicon.png" |
| 249 |
|
| 250 |
# Add any paths that contain custom static files (such as style sheets) here, |
| 251 |
# relative to this directory. They are copied after the builtin static files, |
| 252 |
# so a file named "default.css" will overwrite the builtin "default.css". |
| 253 |
# html_static_path = ['_static'] |
| 254 |
|
| 255 |
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, |
| 256 |
# using the given strftime format. |
| 257 |
# html_last_updated_fmt = '%b %d, %Y' |
| 258 |
|
| 259 |
# If true, SmartyPants will be used to convert quotes and dashes to |
| 260 |
# typographically correct entities. |
| 261 |
# html_use_smartypants = True |
| 262 |
|
| 263 |
# Custom sidebar templates, maps document names to template names. |
| 264 |
# html_sidebars = {} |
| 265 |
# html_sidebars = {'index': 'indexsidebar.html'} |
| 266 |
|
| 267 |
html_sidebars = { |
| 268 |
"index": [ |
| 269 |
"slim_searchbox.html", |
| 270 |
"sidebarintro.html", |
| 271 |
"globaltoc.html", |
| 272 |
"links.html", |
| 273 |
"sourcelink.html", |
| 274 |
], |
| 275 |
"**": [ |
| 276 |
"slim_searchbox.html", |
| 277 |
"globaltoc.html", |
| 278 |
"relations.html", |
| 279 |
"links.html", |
| 280 |
"sourcelink.html", |
| 281 |
], |
| 282 |
} |
| 283 |
|
| 284 |
# Additional templates that should be rendered to pages, maps page names to |
| 285 |
# template names. |
| 286 |
# html_additional_pages = {} |
| 287 |
# html_additional_pages = {'index': 'index.html'} |
| 288 |
|
| 289 |
|
| 290 |
# If false, no module index is generated. |
| 291 |
html_domain_indices = True |
| 292 |
|
| 293 |
# If false, no index is generated. |
| 294 |
html_use_index = False |
| 295 |
|
| 296 |
# If true, the index is split into individual pages for each letter. |
| 297 |
# html_split_index = False |
| 298 |
|
| 299 |
# If true, links to the reST sources are added to the pages. |
| 300 |
html_show_sourcelink = False |
| 301 |
|
| 302 |
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. |
| 303 |
# html_show_sphinx = True |
| 304 |
|
| 305 |
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. |
| 306 |
# html_show_copyright = True |
| 307 |
|
| 308 |
# If true, an OpenSearch description file will be output, and all pages will |
| 309 |
# contain a <link> tag referring to it. The value of this option must be the |
| 310 |
# base URL from which the finished HTML is served. |
| 311 |
# html_use_opensearch = '' |
| 312 |
|
| 313 |
# This is the file name suffix for HTML files (e.g. ".xhtml"). |
| 314 |
# html_file_suffix = None |
| 315 |
|
| 316 |
# Output file base name for HTML help builder. |
| 317 |
htmlhelp_basename = "pytestdoc" |
| 318 |
|
| 319 |
|
| 320 |
# -- Options for LaTeX output -------------------------------------------------- |
| 321 |
|
| 322 |
# The paper size ('letter' or 'a4'). |
| 323 |
# latex_paper_size = 'letter' |
| 324 |
|
| 325 |
# The font size ('10pt', '11pt' or '12pt'). |
| 326 |
# latex_font_size = '10pt' |
| 327 |
|
| 328 |
# Grouping the document tree into LaTeX files. List of tuples |
| 329 |
# (source start file, target name, title, author, documentclass [howto/manual]). |
| 330 |
latex_documents = [ |
| 331 |
( |
| 332 |
"contents", |
| 333 |
"pytest.tex", |
| 334 |
"pytest Documentation", |
| 335 |
"holger krekel, trainer and consultant, https://merlinux.eu/", |
| 336 |
"manual", |
| 337 |
) |
| 338 |
] |
| 339 |
|
| 340 |
# The name of an image file (relative to this directory) to place at the top of |
| 341 |
# the title page. |
| 342 |
latex_logo = "img/pytest1.png" |
| 343 |
|
| 344 |
# For "manual" documents, if this is true, then toplevel headings are parts, |
| 345 |
# not chapters. |
| 346 |
# latex_use_parts = False |
| 347 |
|
| 348 |
# If true, show page references after internal links. |
| 349 |
# latex_show_pagerefs = False |
| 350 |
|
| 351 |
# If true, show URL addresses after external links. |
| 352 |
# latex_show_urls = False |
| 353 |
|
| 354 |
# Additional stuff for the LaTeX preamble. |
| 355 |
# latex_preamble = '' |
| 356 |
|
| 357 |
# Documents to append as an appendix to all manuals. |
| 358 |
# latex_appendices = [] |
| 359 |
|
| 360 |
# If false, no module index is generated. |
| 361 |
latex_domain_indices = False |
| 362 |
|
| 363 |
# -- Options for manual page output -------------------------------------------- |
| 364 |
|
| 365 |
# One entry per manual page. List of tuples |
| 366 |
# (source start file, name, description, authors, manual section). |
| 367 |
man_pages = [ |
| 368 |
("how-to/usage", "pytest", "pytest usage", ["holger krekel at merlinux eu"], 1) |
| 369 |
] |
| 370 |
|
| 371 |
|
| 372 |
# -- Options for Epub output --------------------------------------------------- |
| 373 |
|
| 374 |
# Bibliographic Dublin Core info. |
| 375 |
epub_title = "pytest" |
| 376 |
epub_author = "holger krekel at merlinux eu" |
| 377 |
epub_publisher = "holger krekel at merlinux eu" |
| 378 |
epub_copyright = "2013, holger krekel et alii" |
| 379 |
|
| 380 |
# The language of the text. It defaults to the language option |
| 381 |
# or en if the language is not set. |
| 382 |
# epub_language = '' |
| 383 |
|
| 384 |
# The scheme of the identifier. Typical schemes are ISBN or URL. |
| 385 |
# epub_scheme = '' |
| 386 |
|
| 387 |
# The unique identifier of the text. This can be an ISBN number |
| 388 |
# or the project homepage. |
| 389 |
# epub_identifier = '' |
| 390 |
|
| 391 |
# A unique identification for the text. |
| 392 |
# epub_uid = '' |
| 393 |
|
| 394 |
# HTML files that should be inserted before the pages created by sphinx. |
| 395 |
# The format is a list of tuples containing the path and title. |
| 396 |
# epub_pre_files = [] |
| 397 |
|
| 398 |
# HTML files that should be inserted after the pages created by sphinx. |
| 399 |
# The format is a list of tuples containing the path and title. |
| 400 |
# epub_post_files = [] |
| 401 |
|
| 402 |
# A list of files that should not be packed into the epub file. |
| 403 |
# epub_exclude_files = [] |
| 404 |
|
| 405 |
# The depth of the table of contents in toc.ncx. |
| 406 |
# epub_tocdepth = 3 |
| 407 |
|
| 408 |
# Allow duplicate toc entries. |
| 409 |
# epub_tocdup = True |
| 410 |
|
| 411 |
|
| 412 |
# -- Options for texinfo output ------------------------------------------------ |
| 413 |
|
| 414 |
texinfo_documents = [ |
| 415 |
( |
| 416 |
master_doc, |
| 417 |
"pytest", |
| 418 |
"pytest Documentation", |
| 419 |
( |
| 420 |
"Holger Krekel@*Benjamin Peterson@*Ronny Pfannschmidt@*" |
| 421 |
"Floris Bruynooghe@*others" |
| 422 |
), |
| 423 |
"pytest", |
| 424 |
"simple powerful testing with Python", |
| 425 |
"Programming", |
| 426 |
1, |
| 427 |
) |
| 428 |
] |
| 429 |
|
| 430 |
|
| 431 |
intersphinx_mapping = { |
| 432 |
"pluggy": ("https://pluggy.readthedocs.io/en/stable", None), |
| 433 |
"python": ("https://docs.python.org/3", None), |
| 434 |
"numpy": ("https://numpy.org/doc/stable", None), |
| 435 |
"pip": ("https://pip.pypa.io/en/stable", None), |
| 436 |
"tox": ("https://tox.wiki/en/stable", None), |
| 437 |
"virtualenv": ("https://virtualenv.pypa.io/en/stable", None), |
| 438 |
"setuptools": ("https://setuptools.pypa.io/en/stable", None), |
| 439 |
"packaging": ("https://packaging.python.org/en/latest", None), |
| 440 |
} |
| 441 |
|
| 442 |
|
| 443 |
def configure_logging(app: "sphinx.application.Sphinx") -> None: |
| 444 |
"""Configure Sphinx's WarningHandler to handle (expected) missing include.""" |
| 445 |
import logging |
| 446 |
|
| 447 |
import sphinx.util.logging |
| 448 |
|
| 449 |
class WarnLogFilter(logging.Filter): |
| 450 |
def filter(self, record: logging.LogRecord) -> bool: |
| 451 |
"""Ignore warnings about missing include with "only" directive. |
| 452 |
|
| 453 |
Ref: https://github.com/sphinx-doc/sphinx/issues/2150.""" |
| 454 |
if ( |
| 455 |
record.msg.startswith('Problems with "include" directive path:') |
| 456 |
and "_changelog_towncrier_draft.rst" in record.msg |
| 457 |
): |
| 458 |
return False |
| 459 |
return True |
| 460 |
|
| 461 |
logger = logging.getLogger(sphinx.util.logging.NAMESPACE) |
| 462 |
warn_handler = [x for x in logger.handlers if x.level == logging.WARNING] |
| 463 |
assert len(warn_handler) == 1, warn_handler |
| 464 |
warn_handler[0].filters.insert(0, WarnLogFilter()) |
| 465 |
|
| 466 |
|
| 467 |
def setup(app: "sphinx.application.Sphinx") -> None: |
| 468 |
app.add_crossref_type( |
| 469 |
"fixture", |
| 470 |
"fixture", |
| 471 |
objname="built-in fixture", |
| 472 |
indextemplate="pair: %s; fixture", |
| 473 |
) |
| 474 |
|
| 475 |
app.add_object_type( |
| 476 |
"confval", |
| 477 |
"confval", |
| 478 |
objname="configuration value", |
| 479 |
indextemplate="pair: %s; configuration value", |
| 480 |
) |
| 481 |
|
| 482 |
app.add_object_type( |
| 483 |
"globalvar", |
| 484 |
"globalvar", |
| 485 |
objname="global variable interpreted by pytest", |
| 486 |
indextemplate="pair: %s; global variable interpreted by pytest", |
| 487 |
) |
| 488 |
|
| 489 |
app.add_crossref_type( |
| 490 |
directivename="hook", |
| 491 |
rolename="hook", |
| 492 |
objname="pytest hook", |
| 493 |
indextemplate="pair: %s; hook", |
| 494 |
) |
| 495 |
|
| 496 |
configure_logging(app) |
| 497 |
|
| 498 |
# legacypath.py monkey-patches pytest.Testdir in. Import the file so |
| 499 |
# that autodoc can discover references to it. |
| 500 |
import _pytest.legacypath # noqa: F401 |