Catch any warning on warns with no arg passed

This commit is contained in:
Olga Matoula
2021-05-15 15:15:43 +01:00
parent c516dba69a
commit 8b2f83772d
8 changed files with 45 additions and 11 deletions

View File

@@ -332,11 +332,11 @@ You can record raised warnings either using func:`pytest.warns` or with
the ``recwarn`` fixture.
To record with func:`pytest.warns` without asserting anything about the warnings,
pass ``None`` as the expected warning type:
pass no arguments as the expected warning type and it will default to a generic Warning:
.. code-block:: python
with pytest.warns(None) as record:
with pytest.warns() as record:
warnings.warn("user", UserWarning)
warnings.warn("runtime", RuntimeWarning)