Exemplo n.º 1
0
    def test_pre_init_executor(self):
        executor = Executor()

        @executor.job
        def decorated(n):
            return fib(n)

        assert executor
        executor.init_app(self.app)
        with self.app.test_request_context(''):
            future = decorated.submit(5)
        assert future.result() == fib(5)
Exemplo n.º 2
0
 def test_factory_init(self):
     self.app = Flask(__name__)
     executor = Executor()
     executor.init_app(self.app)
     assert 'executor' in self.app.extensions
     assert isinstance(executor._self, concurrent.futures._base.Executor)