Abort tests when instances leaked (#7623)

This commit is contained in:
Paulus Schoutsen authored and Pascal Vizeli committed 2017-05-18 00:19:40 +02:00
1 parent f86edd4f24
commit a068efcd47
2 files changed
+11 -10

No files matched your search

+7 -3
View File
@@ -12,7 +12,7 @@ from homeassistant import util, setup
from homeassistant.util import location
from homeassistant.components import mqtt
from tests.common import async_test_home_assistant, mock_coro
from tests.common import async_test_home_assistant, mock_coro, INSTANCES
from tests.test_util.aiohttp import mock_aiohttp_client
from tests.mock.zwave import MockNetwork, MockOption
@@ -50,8 +50,12 @@ def verify_cleanup():
"""Verify that the test has cleaned up resources correctly."""
yield
from tests import common
assert common.INST_COUNT < 2
if len(INSTANCES) >= 2:
count = len(INSTANCES)
for inst in INSTANCES:
inst.stop()
pytest.exit("Detected non stopped instances "
"({}), aborting test run".format(count))
@pytest.fixture