Esempio n. 1
0
    def test_shutdown_sigterm(self):
        shutdownExecuted = []

        @config.shutdown_handler
        def shutdown():
            shutdownExecuted.append(True)

        shutdown = sys.modules['ptah.config']
        shutdown._shutdown = False
        try:
            shutdown.process_shutdown(signal.SIGTERM, None)
        except:
            pass

        self.assertTrue(shutdownExecuted[0])
Esempio n. 2
0
    def test_shutdown_sigterm(self):
        shutdownExecuted = []

        @config.shutdown_handler
        def shutdown():
            shutdownExecuted.append(True)

        shutdown = sys.modules['ptah.config']
        shutdown._shutdown = False
        try:
            shutdown.process_shutdown(signal.SIGTERM, None)
        except:
            pass

        self.assertTrue(shutdownExecuted[0])
Esempio n. 3
0
    def test_shutdown_exception_in_handler(self):

        @config.shutdown_handler
        def shutdown():
            raise ValueError()

        from ptah.config import shutdown
        shutdown._shutdown = False

        err = None
        try:
            shutdown.process_shutdown(signal.SIGINT, None)
        except BaseException as e:
            err = e

        self.assertFalse(isinstance(err, ValueError))