-
Notifications
You must be signed in to change notification settings - Fork 12
/
pytest.ini
161 lines (150 loc) · 9.33 KB
/
pytest.ini
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
# --------------------( LICENSE )--------------------
# Copyright 2014-2025 by Alexis Pietak & Cecil Curry.
# See "LICENSE" for further details.
#
# --------------------( SYNOPSIS )--------------------
# Project-wide "pytest.ini" configuration, applied to all invocations of
# the pytest test runner within this project -- including both by directly
# running the external "pytest" command and by indirectly running the
# setuptools-harnessed "python3 setup.py test" subcommand.
#
# --------------------( 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.
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# NOTE: For a list of all project-specific CLI options unconditionally passed
# to all invocations of this project's external command by functional tests,
# see the "betse_test.func.cli.fixture.clier" submodule.
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# ....................{ 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 =
; error
# 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
# ....................{ 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.
# * "-r a", increasing verbosity of (a)ll types of test summaries.
# * "-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 for this CLI-only project.
# Although technically harmless, this plugin unconditionally logs extraneous
# messages that hamper readability of pytest output. Ergo, it goes.
# * "--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 also the "betse.lib.setuptools.command.supcmdtest" submodule for
# additional options passed when indirectly running the "pytest" command via
# either the "test" shell script or "python3 setup.py test" subcommand.
#
# 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=
# 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 = betse_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.
# ....................{ OPTIONS ~ plugin : qt }...................
# Options specific to "pytest-qt".
#FIXME: Preserved for posterity. Reenable if required. *shrug*
# # Force "pytest-qt" to use PySide2 rather than alternative Qt bindings, as
# # required by downstream consumers (e.g., BETSEE).
# qt_api = pyside2