예제 #1
0
    def test_externalize_reacts_to_exceptions(self):
        """If unhandled, exceptions in externalize hang forever. Catch them."""
        def fail():

            raise ValueError()

        test = BasicProfile('', '')
        with self.assertRaises(ValueError):

            test._externalize(fail)
예제 #2
0
    def test_externalize_reacts_to_exceptions(self):
        """If unhandled, exceptions in externalize hang forever. Catch them."""

        def fail():

            raise ValueError()

        test = BasicProfile('','')
        with self.assertRaises(ValueError):

            test._externalize(fail)
예제 #3
0
    def test_externalize_runs_somewhere_else(self):

        success = True

        def toggle():

            # This will only affect the success variable above if the code
            # is executed in the same Python process as the test.
            global success
            success = False

        test = BasicProfile('', '')
        test._externalize(toggle)
        self.assertTrue(success)
예제 #4
0
    def test_externalize_runs_somewhere_else(self):

        success = True

        def toggle():

            # This will only affect the success variable above if the code
            # is executed in the same Python process as the test.
            global success
            success = False

        test = BasicProfile('', '')
        test._externalize(toggle)
        self.assertTrue(success)