mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-08 20:04:59 -04:00
Add missing types to tests.util. (#14597)
Removes files under tests.util from the ignored by list, then fully types all tests/util/*.py files.
This commit is contained in:
parent
fac8a38525
commit
acea4d7a2f
21 changed files with 361 additions and 276 deletions
|
@ -49,7 +49,7 @@ class ReadWriteLockTestCase(unittest.TestCase):
|
|||
acquired_d: "Deferred[None]" = Deferred()
|
||||
unblock_d: "Deferred[None]" = Deferred()
|
||||
|
||||
async def reader_or_writer():
|
||||
async def reader_or_writer() -> str:
|
||||
async with read_or_write(key):
|
||||
acquired_d.callback(None)
|
||||
await unblock_d
|
||||
|
@ -134,7 +134,7 @@ class ReadWriteLockTestCase(unittest.TestCase):
|
|||
d.called, msg="deferred %d was unexpectedly resolved" % (i + n)
|
||||
)
|
||||
|
||||
def test_rwlock(self):
|
||||
def test_rwlock(self) -> None:
|
||||
rwlock = ReadWriteLock()
|
||||
key = "key"
|
||||
|
||||
|
@ -197,7 +197,7 @@ class ReadWriteLockTestCase(unittest.TestCase):
|
|||
_, acquired_d = self._start_nonblocking_reader(rwlock, key, "last reader")
|
||||
self.assertTrue(acquired_d.called)
|
||||
|
||||
def test_lock_handoff_to_nonblocking_writer(self):
|
||||
def test_lock_handoff_to_nonblocking_writer(self) -> None:
|
||||
"""Test a writer handing the lock to another writer that completes instantly."""
|
||||
rwlock = ReadWriteLock()
|
||||
key = "key"
|
||||
|
@ -216,7 +216,7 @@ class ReadWriteLockTestCase(unittest.TestCase):
|
|||
d3, _ = self._start_nonblocking_writer(rwlock, key, "write 3 completed")
|
||||
self.assertTrue(d3.called)
|
||||
|
||||
def test_cancellation_while_holding_read_lock(self):
|
||||
def test_cancellation_while_holding_read_lock(self) -> None:
|
||||
"""Test cancellation while holding a read lock.
|
||||
|
||||
A waiting writer should be given the lock when the reader holding the lock is
|
||||
|
@ -242,7 +242,7 @@ class ReadWriteLockTestCase(unittest.TestCase):
|
|||
)
|
||||
self.assertEqual("write completed", self.successResultOf(writer_d))
|
||||
|
||||
def test_cancellation_while_holding_write_lock(self):
|
||||
def test_cancellation_while_holding_write_lock(self) -> None:
|
||||
"""Test cancellation while holding a write lock.
|
||||
|
||||
A waiting reader should be given the lock when the writer holding the lock is
|
||||
|
@ -268,7 +268,7 @@ class ReadWriteLockTestCase(unittest.TestCase):
|
|||
)
|
||||
self.assertEqual("read completed", self.successResultOf(reader_d))
|
||||
|
||||
def test_cancellation_while_waiting_for_read_lock(self):
|
||||
def test_cancellation_while_waiting_for_read_lock(self) -> None:
|
||||
"""Test cancellation while waiting for a read lock.
|
||||
|
||||
Tests that cancelling a waiting reader:
|
||||
|
@ -319,7 +319,7 @@ class ReadWriteLockTestCase(unittest.TestCase):
|
|||
)
|
||||
self.assertEqual("write 2 completed", self.successResultOf(writer2_d))
|
||||
|
||||
def test_cancellation_while_waiting_for_write_lock(self):
|
||||
def test_cancellation_while_waiting_for_write_lock(self) -> None:
|
||||
"""Test cancellation while waiting for a write lock.
|
||||
|
||||
Tests that cancelling a waiting writer:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue