def test_try_shared_variation(self): lock = dblocks.DatabaseXactLock(random_objid()) self.assertThat(lock.TRY.SHARED, Equals(lock)) self.assertDocTestMatches( "SELECT pg_try_advisory_xact_lock_shared(...)", capture_queries_while_holding_lock(lock.TRY.SHARED), )
def test_plain_variation(self): lock = dblocks.DatabaseXactLock(random_objid()) self.assertDocTestMatches("SELECT pg_advisory_xact_lock(...)", capture_queries_while_holding_lock(lock))
def make_lock(self, objid): return dblocks.DatabaseXactLock(objid, mode=self.mode)