On this page
Ini-key registration, validation and resolution: the five required safety keys, the closed preservation enum, and the parameterized floor constants.
#python.src.stricttest.config
#python.src.stricttest.config
Ini-file configuration for the stricttest floor.
Every knob lives in [tool.pytest.ini_options] (or pytest.ini / tox.ini / setup.cfg -- anything pytest reads as ini).
Installing the plugin IS adoption: the safety keys below are REQUIRED and a missing one aborts the session at configure time. There are no implicit defaults for the socket stance, the socket allowlists, or the sandbox stance -- a repo must declare where it stands before its suite is allowed to run.
#_Missing
Sentinel default for every ini key.
Presence must be distinguishable from an explicitly-empty value: a project that writes stricttest_socket_allowlist = [] has declared its stance, while one that omits the key has not. Registering this sentinel as each key's default makes getini itself report presence, without reaching for the deprecated config.inicfg.
#Settings
Resolved, validated stricttest configuration for one pytest session.
#add_ini_options
def add_ini_options(parser) -> NoneRegister every stricttest ini key with pytest's parser.
#_present
def _present(config, key: str) -> boolTrue when key was actually written in the ini file.
#parse_host_port
def parse_host_port(entry: str) -> tuple[str, str]Parse one allowlist entry into (host, port).
Bracketed form [::1]:5432 carries IPv6 literals; the plain form is host:port. Anything else is a configuration error.
#missing_required_keys
def missing_required_keys(config) -> list[str]Return the required ini keys absent from this project's config.
#remediation_block
def remediation_block(inipath) -> strThe most-restrictive starting stance, in inipath's own syntax.
A configuration snippet a project cannot paste is not remediation. TOML quotes values and writes lists in brackets; classic ini files take literal unquoted text and one list entry per indented line, so a TOML block pasted into pytest.ini produces a second error instead of a fix.
None (no ini file at all yet) renders TOML, because the file such a project should create is pyproject.toml.
#required_keys_error
def required_keys_error(config, missing: list[str]) -> pytest.UsageErrorBuild the precise configure-time abort for missing safety keys.
#resolve
def resolve(config) -> SettingsValidate and resolve the full settings object, or raise UsageError.