mirror of
https://github.com/home-assistant/core.git
synced 2026-10-06 22:38:02 -04:00
Log the number of xdist workers in pytest runs (#183682)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
This commit is contained in:
+11
-1
@@ -1,7 +1,7 @@
|
||||
"""Set up some common test helper things."""
|
||||
|
||||
import asyncio
|
||||
from collections.abc import AsyncGenerator, Callable, Coroutine, Generator
|
||||
from collections.abc import AsyncGenerator, Callable, Coroutine, Generator, Sequence
|
||||
from contextlib import AsyncExitStack, asynccontextmanager, contextmanager
|
||||
import datetime
|
||||
import functools
|
||||
@@ -33,6 +33,7 @@ from aiohttp.typedefs import JSONDecoder
|
||||
from aiohttp.web import Application
|
||||
import bcrypt
|
||||
from bleak_retry_connector import bleak_manager
|
||||
import execnet
|
||||
import freezegun
|
||||
import multidict
|
||||
import pytest
|
||||
@@ -177,6 +178,15 @@ def pytest_configure(config: pytest.Config) -> None:
|
||||
logging.getLogger().setLevel(logging.DEBUG)
|
||||
|
||||
|
||||
@pytest.hookimpl(optionalhook=True)
|
||||
def pytest_xdist_setupnodes(
|
||||
config: pytest.Config, specs: Sequence[execnet.XSpec]
|
||||
) -> None:
|
||||
"""Log the number of xdist workers, also when running with -qq."""
|
||||
if reporter := config.pluginmanager.get_plugin("terminalreporter"):
|
||||
reporter.write_line(f"xdist workers: {len(specs)}")
|
||||
|
||||
|
||||
class HASocketBlockedError(pytest_socket.SocketBlockedError):
|
||||
"""SocketBlockedError variant which counts instances."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user