summary refs log tree commit diff
path: root/tests/unittest.py
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2021-12-07 16:51:53 +0000
committerGitHub <noreply@github.com>2021-12-07 11:51:53 -0500
commitd6fb96e056f79de220d8d59429d89a61498e9af3 (patch)
tree04f92995aaa7345d304934a21212f8071a70a876 /tests/unittest.py
parentSort internal changes in changelog (diff)
downloadsynapse-d6fb96e056f79de220d8d59429d89a61498e9af3.tar.xz
Fix case in `wait_for_background_updates` where `self.store` does not exist (#11331)
Pull the DataStore from the HomeServer instance, which
always exists.
Diffstat (limited to '')
-rw-r--r--tests/unittest.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/tests/unittest.py b/tests/unittest.py
index eea0903f05..1431848367 100644
--- a/tests/unittest.py
+++ b/tests/unittest.py
@@ -331,16 +331,13 @@ class HomeserverTestCase(TestCase):
             time.sleep(0.01)
 
     def wait_for_background_updates(self) -> None:
-        """Block until all background database updates have completed.
-
-        Note that callers must ensure there's a store property created on the
-        testcase.
-        """
+        """Block until all background database updates have completed."""
+        store = self.hs.get_datastore()
         while not self.get_success(
-            self.store.db_pool.updates.has_completed_background_updates()
+            store.db_pool.updates.has_completed_background_updates()
         ):
             self.get_success(
-                self.store.db_pool.updates.do_next_background_update(False), by=0.1
+                store.db_pool.updates.do_next_background_update(False), by=0.1
             )
 
     def make_homeserver(self, reactor, clock):