Exemple #1
0
    def test_shutdown_exception_in_handler(self):
        shutdownExecuted = []

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

        from memphis.config import shutdown
        shutdown._shutdown = False
        try:
            shutdown.processShutdown(signal.SIGINT, None)
        except BaseException, e:
            pass
Exemple #2
0
    def test_shutdown_sigterm(self):
        shutdownExecuted = []

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

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

        self.assertTrue(shutdownExecuted[0])