Fix races on recorder test (#11857)

This commit is contained in:
Sean Dague authored and Pascal Vizeli committed 2018-01-22 15:21:56 +01:00
1 parent b224fd324d
commit d478517c51
1 file changed
+2 -3
+2 -3
View File
@@ -1,7 +1,6 @@
"""Test data purging.""" """Test data purging."""
import json import json
from datetime import datetime, timedelta from datetime import datetime, timedelta
from time import sleep
import unittest import unittest
from homeassistant.components import recorder from homeassistant.components import recorder
@@ -162,7 +161,7 @@ class TestRecorderPurge(unittest.TestCase):
self.hass.async_block_till_done() self.hass.async_block_till_done()
# Small wait for recorder thread # Small wait for recorder thread
sleep(0.1) self.hass.data[DATA_INSTANCE].block_till_done()
# we should still have everything from before # we should still have everything from before
self.assertEqual(states.count(), 6) self.assertEqual(states.count(), 6)
@@ -174,7 +173,7 @@ class TestRecorderPurge(unittest.TestCase):
self.hass.async_block_till_done() self.hass.async_block_till_done()
# Small wait for recorder thread # 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 # we should only have 3 states left after purging
self.assertEqual(states.count(), 3) self.assertEqual(states.count(), 3)