You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 353934c
Browse filesBrowse the repository at this point in the historyBrowse files
Accept type expressions in Parser.addini(type=...)
Address review feedback in #14692:
- Replace the tuple-of-tags API with type expressions, as proposed by
bluetech in #14675: plain Python types (str, bool, int, float) and
unions of them (e.g. `int | str`) are now accepted in addition to
the existing string tags. The truncation options are registered with
`type=int | str`.
- Raise ValueError instead of asserting on an invalid `type` argument,
since it is user (plugin) provided.
- Raise ValueError when a union type is registered without an explicit
default, instead of silently defaulting to None.
- Document the _IniTypeTag/_INI_TYPE_TAGS keep-in-sync requirement.
:func:`parser.addini <pytest.Parser.addini>` now also accepts plain Python types (``str``, ``bool``, ``int``, ``float``) and unions of them (for example ``int | str``) for its ``type`` argument, in addition to the existing string tags. A union accepts a value of any of its member types.
0 commit comments