Ver código fonte

Fix case in `wait_for_background_updates` where `self.store` does not exist (#11331)

Pull the DataStore from the HomeServer instance, which
always exists.
tags/v1.50.0rc1
Andrew Morgan 2 anos atrás
committed by GitHub
pai
commit
d6fb96e056
Nenhuma chave conhecida encontrada para esta assinatura no banco de dados ID da chave GPG: 4AEE18F83AFDEB23
2 arquivos alterados com 5 adições e 7 exclusões
  1. +1
    -0
      changelog.d/11331.misc
  2. +4
    -7
      tests/unittest.py

+ 1
- 0
changelog.d/11331.misc Ver arquivo

@@ -0,0 +1 @@
A test helper (`wait_for_background_updates`) no longer depends on classes defining a `store` property.

+ 4
- 7
tests/unittest.py Ver arquivo

@@ -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):


Carregando…
Cancelar
Salvar