Exemplo n.º 1
0
 def test_context(self):
     statuses = []
     with tor.add_context(statuses.append, "context"):
         pass
     self.assertEqual(statuses, ["context"])
     statuses = []
     def _try():
         with tor.add_context(statuses.append, "context"):
             raise ValueError("foo")
     e = self.assertRaises(ValueError, _try)
     self.assertEqual(statuses, ["context"])
     self.assert_(hasattr(e, "foolscap_connection_handler_error_suffix"))
     self.assertEqual(e.foolscap_connection_handler_error_suffix,
                      " (while context)")
Exemplo n.º 2
0
    def test_context(self):
        statuses = []
        with tor.add_context(statuses.append, "context"):
            pass
        self.assertEqual(statuses, ["context"])
        statuses = []

        def _try():
            with tor.add_context(statuses.append, "context"):
                raise ValueError("foo")

        e = self.assertRaises(ValueError, _try)
        self.assertEqual(statuses, ["context"])
        self.assertTrue(hasattr(e, "foolscap_connection_handler_error_suffix"))
        self.assertEqual(e.foolscap_connection_handler_error_suffix,
                         " (while context)")
Exemplo n.º 3
0
 def _try():
     with tor.add_context(statuses.append, "context"):
         raise ValueError("foo")
Exemplo n.º 4
0
 def _try():
     with tor.add_context(statuses.append, "context"):
         raise ValueError("foo")