1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
|
# --------------------( LICENSE )--------------------
# Copyright (c) 2014-2025 Beartype authors.
# See "LICENSE" for further details.
#
# --------------------( SYNOPSIS )--------------------
# Project-wide pytest configuration, applied to all invocations of the pytest
# test runner within this project.
#
# --------------------( DETAILS )--------------------
# To permit tests to transparently import from the main non-test codebase, this
# file resides in the root project directory. pytest then:
#
# 1. Recursively finds this file.
# 2. Sets "config.inifile" to the absolute path of this file.
# 3. Sets "config.rootdir" to the absolute path of this file's directory.
#
# See https://pytest.org/latest/customize.html for details.
# ....................{ BOILERPLATE }...................
# The following pytest-specific section specifier is mandatory, despite this
# file's unambiguous basename of "pytest.ini". One is enraged by bureaucracy!
[pytest]
# Newline-delimited list of all custom warning filters applied by this test
# suite. Recognized strings include:
# * "default", printing the first occurrence of matching warnings for each
# location (module + line number) where the warning is issued.
# Unsurprisingly, this is pytest's default. Surprisingly, the resulting
# output is overly fine-grained to the point of stripping all caller context
# and thus being mostly useless: e.g.,
# betse_test/func/sim/solve/test_sim_fast.py::test_cli_sim_fast
# /usr/lib/python3.7/site-packages/numpy/core/_asarray.py:83:
# VisibleDeprecationWarning: Creating an ndarray from ragged nested
# sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays
# with different lengths or shapes) is deprecated. If you meant to do
# this, you must specify 'dtype=object' when creating the ndarray
# return array(a, dtype, copy=False, order=order)
# Note that pytest reports the warning as originating from within a private
# NumPy submodule, which it technically does but which communicates no
# practical meaning with respect to our codebase.
# * "error", turning matching warnings into exceptions. Ideally, pytest would
# support a filter printing tracebacks on warnings. Since it fails to do so,
# implicitly printing tracebacks by coercing non-fatal warnings into fatal
# exceptions is our next best least worst solution.
filterwarnings =
# Implicitly coerce all non-fatal warnings into fatal exceptions.
error
# Avoid coercing all non-fatal warnings matching one or more of the
# following patterns formatted as:
# ignore:{warning_message}:{warning_classname}:{module_name}
#
# ...where:
# * "{warning_message}" is a regular expression matching the plaintext of
# the warning message to be ignored.
# * "{warning_classname}" is the fully-qualified classname of the warning
# to be ignored.
# * "{module_name}" is the fully-qualified name of the module emitting the
# warning to be ignored.
#
# For example:
# ignore:^Use of \.\. or absolute path in a resource path.*:DeprecationWarning:pkg_resources
#
# See also:
# * https://docs.python.org/3/library/warnings.html and
# * https://docs.pytest.org/en/latest/warnings.html
ignore:^'cgi' is deprecated and slated for removal in Python 3\.13$:DeprecationWarning:babel.messages.catalog
# Newline-delimited list of all custom marks applied by this test suite.
# Failing to explicitly list such marks here induces non-fatal warnings: e.g.,
# /usr/lib64/python3.6/site-packages/_pytest/mark/structures.py:335
# /usr/lib64/python3.6/site-packages/_pytest/mark/structures.py:335:
# PytestUnknownMarkWarning: Unknown pytest.mark.noop - is this a typo?
# You can register custom marks to avoid this warning - for details, see
# https://docs.pytest.org/en/latest/mark.html
# PytestUnknownMarkWarning,
markers =
noop: meaningless placeholder mark required to conditionally skip tests
# ....................{ LOGGING }...................
#FIXME: Uncomment to print logging messages.
; # If true, captures and prints logging messages whose level is at least
; # {log_cli_level} or higher. (Defaults to false.)
; log_cli = True
;
; # Minimum level of logging messages to be captured and printed if {log_cli} is
; # true. (Defaults to "INFO".)
; log_cli_level = DEBUG
# ....................{ OPTIONS }...................
#FIXME: Conditionally support the following plugin-based options in an
#appropriate setuptools command when the requisite plugin is importable:
#
#* "--instafail", immediately printing test output rather than delaying such
# output until after all tests complete. This requires the "pytest-instafail"
# plugin. Note that this may not necessarily play nicely with the
# "--capture=no" option leveraged below. Consider further testing.
#FIXME: Pass "--ff" and "--tb=auto" when all test machines have a sufficiently
#new version of pytest installed.
# Unconditionally pass the following command-line options to all invocations of
# the "pytest" command. Dismantled, this is:
#
# * "-v", increasing verbosity.
# * "--full-trace", printing a full traceback on keyboard interrupts (e.g.,
# hitting <Ctrl-C> during testing at the command line).
# * "-p no:asyncio", disabling the "pytest-asyncio" plugin -- which is
# *ABSOLUTELY* mad, doing horrifying things with unexpected side effects like:
# * Unconditionally importing *EVERYTHING* in our friggin' test suite, which
# then promptly raises non-human-readable exceptions during early test
# collection time. Like, "Just no, you imbecilic plugin!" Many of the
# submodules in our test suite are only safely importable in a conditional
# test-specific context.
# * Emitting senseless deprecation warnings on "pytest" startup resembling:
# INTERNALERROR> Traceback (most recent call last):
# ...
# INTERNALERROR> File "/usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py", line 186, in pytest_configure
# INTERNALERROR> config.issue_config_time_warning(LEGACY_MODE, stacklevel=2)
# INTERNALERROR> File "/usr/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1321, in issue_config_time_warning
# INTERNALERROR> warnings.warn(warning, stacklevel=stacklevel)
# INTERNALERROR> DeprecationWarning: The 'asyncio_mode' default value will change to 'strict' in future, please explicitly use 'asyncio_mode=strict' or 'asyncio_mode=auto' in pytest configuration file.
#
# This is *ABSOLUTELY* senseless, because this project intentionally does
# *NOT* require, reference, or otherwise leverage "pytest-asyncio" anywhere.
# However, many other third-party packages you may have installed do. Thanks
# to them, *ALL* "pytest" invocations must now pass this vapid setting to
# avoid spewing trash across *ALL* "pytest"-driven test sessions. *double
# facepalm*
# * "-p no:jaxtyping", disabling the "pytest-jaxtyping" plugin -- which *COULD*
# attempt to unsafely import JAX at test collection time. If this plugin does
# so, then the first unit test requiring forked subprocess isolation will
# inscrutably fail with a non-human-readable exception. See also the
# "beartype_test.a90_func.z90_lib.a80_jax.test_jax" submodule for details.
# * "-p no:xvfb", disabling the "pytest-xvfb" plugin. Although technically
# harmless, this plugin unconditionally logs extraneous messages that hamper
# readability of pytest output. Ergo, it goes.
# * "-r a", increasing verbosity of (a)ll types of test summaries.
# * "-s", disable all stdout and stderr capturing.
# * "--doctest-glob=", disabling implicit detection of doctests (i.e., tests
# embedded in docstrings that double as human-readable examples). By default,
# pytest runs all files matching the recursive glob "**/test*.txt" through
# the standard "doctest" module. Since this project employs explicit tests
# rather than implicit doctests, this detection is a non-fatal noop in the
# best case and a fatal conflict in the worst case. For collective sanity,
# this detection *MUST* be disabled.
# * "--failed-first", prioritizing tests that failed ahead of tests that
# succeeded on the most recent test run. Actually, this option has been
# temporarily omitted. Why? Because serial tests currently fail to implicitly
# require prerequisite tests (e.g., "test_cli_sim_default[sim]" fails to
# require "test_cli_sim_default[seed]"), thus requiring that tests be run
# *ONLY* in the default ordering.
# * "--showlocals", printing local variable values in tracebacks.
# * "--tb=native", printing tracebacks in the same manner as tracebacks printed
# by Python itself for uncaught exceptions. By default, pytest prints
# tracebacks in an extremely colourful (which is nice) but unreadable (which
# is *NOT* nice) manner.
#
# See "pytest --help | less" for further details on available options.
addopts = -v --showlocals -p no:asyncio -p no:jaxtyping -p no:xvfb -r a --doctest-glob=
; addopts = -v --showlocals -p no:asyncio -p no:jaxtyping -p no:xvfb -r a --doctest-glob= -s
; addopts = -v --showlocals -p no:asyncio -p no:beartype -p no:jaxtyping -p no:xvfb -r a --doctest-glob=
; addopts = -v --showlocals -p no:asyncio -p no:beartype -p no:jaxtyping -p no:xvfb -r a --doctest-glob= -s
; addopts = -v --showlocals -p no:asyncio -p no:jaxtyping -p no:xvfb -r a --doctest-glob= -s --full-trace
; addopts = -v -p no:asyncio -p no:jaxtyping -p no:xvfb -r a --doctest-glob= --showlocals --tb=native
; addopts = -vv --showlocals -p no:asyncio -p no:jaxtyping -p no:xvfb -r a --doctest-glob=
; addopts = -vv --showlocals -p no:asyncio -p no:jaxtyping -p no:xvfb -r a --doctest-glob= -s --full-trace
; addopts = -vvvv --showlocals -p no:asyncio -p no:jaxtyping -p no:xvfb -r a --doctest-glob=
; addopts = -vvvv --showlocals -p no:asyncio -p no:jaxtyping -p no:xvfb -r a --doctest-glob= -s
; addopts = -s
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# CAUTION: The "--full-trace" option now inadvertently produces absurdly
# verbose, largely unreadable tracebacks. (You have been warned.)
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
; addopts = -v --full-trace --showlocals -p no:xvfb -r a --doctest-glob=
# Minimum version of pytest required by:
#
# * The "--failed-first" option enabled by default above.
# minversion = 2.8.0
# Whitespace-delimited list of the relative paths of all top-level directories
# containing tests. All Python scripts with basenames prefixed by "test_" in
# all subdirectories of these directories including these directories
# themselves will be parsed for:
# * Functions whose names are prefixed by "test_".
# * Classes whose names are prefixed by "Test".
testpaths = beartype_test
# ....................{ OPTIONS ~ plugin }...................
# Options specific to third-party pytest plugins.
#
# Command-line options pertaining to plugins include:
# $ pytest --trace-config # List all active and available plugins.
|