Updated non-blocking timout to 10 seconds for fixing timeout issues. (#23930)

* Updated non-blocking timout to 10 seconds for fixing timeout issues.

* Added failed bridge fixture for faster unit tests.
This commit is contained in:
Tomer Figenblat authored and Paulus Schoutsen committed 2019-05-19 11:24:59 +02:00
1 parent ff867a7d57
commit d7d83c683d
3 files changed
+26 -2

No files matched your search

+22
View File
@@ -108,3 +108,25 @@ def mock_bridge_fixture() -> Generator[None, Any, None]:
for patcher in patchers:
patcher.stop()
@fixture(name='mock_failed_bridge')
def mock_failed_bridge_fixture() -> Generator[None, Any, None]:
"""Fixture for mocking aioswitcher.bridge.SwitcherV2Bridge."""
async def mock_queue():
"""Mock asyncio's Queue."""
raise RuntimeError
patchers = [
patch('aioswitcher.bridge.SwitcherV2Bridge.start', return_value=None),
patch('aioswitcher.bridge.SwitcherV2Bridge.stop', return_value=None),
patch('aioswitcher.bridge.SwitcherV2Bridge.queue', get=mock_queue)
]
for patcher in patchers:
patcher.start()
yield
for patcher in patchers:
patcher.stop()