mirror of
https://github.com/home-assistant/core.git
synced 2025-08-05 13:45:12 +02:00
Fix races on recorder test (#11857)
This commit is contained in:
committed by
Pascal Vizeli
parent
b224fd324d
commit
d478517c51
@@ -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)
|
||||||
|
Reference in New Issue
Block a user