diff --git a/README.rst b/README.rst index f0da202e..7c888870 100644 --- a/README.rst +++ b/README.rst @@ -261,6 +261,7 @@ Changelog - Fixes a bug that prevents async Hypothesis tests from working without explicit ``asyncio`` marker when ``--asyncio-mode=auto`` is set. `#258 `_ - Fixed a bug that closes the default event loop if the loop doesn't exist `#257 `_ - Added type annotations. `#198 `_ +- Show asyncio mode in pytest report headers. `#266 `_ 0.17.0 (22-01-13) ~~~~~~~~~~~~~~~~~~~ diff --git a/pytest_asyncio/plugin.py b/pytest_asyncio/plugin.py index bd6fa6de..8635b624 100644 --- a/pytest_asyncio/plugin.py +++ b/pytest_asyncio/plugin.py @@ -187,6 +187,13 @@ def pytest_configure(config: Config) -> None: config.issue_config_time_warning(LEGACY_MODE, stacklevel=2) +@pytest.mark.tryfirst +def pytest_report_header(config: Config) -> List[str]: + """Add asyncio config to pytest header.""" + mode = _get_asyncio_mode(config) + return [f"asyncio: mode={mode}"] + + @pytest.mark.tryfirst def pytest_pycollect_makeitem( collector: Union[pytest.Module, pytest.Class], name: str, obj: object