Beispiel #1
0
        self.assertEqual(who, target.owner_get())
        target.release(who)

    def test_acquire__busy(self):
        t = ttbl.test_target("a")
        t.acquire(self.user1)
        with self.assertRaises(ttbl.test_target_busy_e):
            t.acquire(self.user2)

    def test_release__bad_args(self):
        t = ttbl.test_target("a")
        with self.assertRaises(ttbl.test_target_not_acquired_e):
            t.release(self.usernil)
        t.acquire(self.user1)
        t.release(self.user1)
        with self.assertRaises(ttbl.test_target_not_acquired_e):
            t.release(self.user1)

    def test_release_force(self):
        t = ttbl.test_target("a")
        t.acquire(self.user1)
        t.release(self.user1, force=True)
        # This has to work now
        t.acquire(self.user2)
        t.release(self.user2)


if __name__ == '__main__':
    testing.logging_init(sys.argv)
    unittest.main()
Beispiel #2
0
        self.assertEqual(who, target.owner_get())
        target.release(who)

    def test_acquire__busy(self):
        t = ttbl.test_target("a")
        t.acquire(self.user1)
        with self.assertRaises(ttbl.test_target_busy_e):
            t.acquire(self.user2)


    def test_release__bad_args(self):
        t = ttbl.test_target("a")
        with self.assertRaises(ttbl.test_target_not_acquired_e):
            t.release(self.usernil)
        t.acquire(self.user1)
        t.release(self.user1)
        with self.assertRaises(ttbl.test_target_not_acquired_e):
            t.release(self.user1)

    def test_release_force(self):
        t = ttbl.test_target("a")
        t.acquire(self.user1)
        t.release(self.user1, force = True)
        # This has to work now
        t.acquire(self.user2)
        t.release(self.user2)

if __name__ == '__main__':
    testing.logging_init(sys.argv)
    unittest.main()