Fix races on recorder test (#11857)

pull/11869/head
Sean Dague 2018-01-22 09:21:56 -05:00 committed by Pascal Vizeli
parent b224fd324d
commit d478517c51
1 changed files with 2 additions and 3 deletions

View File

@ -1,7 +1,6 @@
"""Test data purging."""
import json
from datetime import datetime, timedelta
from time import sleep
import unittest
from homeassistant.components import recorder
@ -162,7 +161,7 @@ class TestRecorderPurge(unittest.TestCase):
self.hass.async_block_till_done()
# Small wait for recorder thread
sleep(0.1)
self.hass.data[DATA_INSTANCE].block_till_done()
# we should still have everything from before
self.assertEqual(states.count(), 6)
@ -174,7 +173,7 @@ class TestRecorderPurge(unittest.TestCase):
self.hass.async_block_till_done()
# Small wait for recorder thread
sleep(0.1)
self.hass.data[DATA_INSTANCE].block_till_done()
# we should only have 3 states left after purging
self.assertEqual(states.count(), 3)