def test_pre_init_executor(default_app):
    executor = Executor()

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

    assert executor
    executor.init_app(default_app)
    with default_app.test_request_context(''):
        future = decorated.submit(5)
    assert future.result() == fib(5)
Beispiel #2
0
def test_factory_init():
    app = Flask(__name__)
    executor = Executor()
    executor.init_app(app)
    assert 'executor' in app.extensions
def test_factory_init(app):
    executor = Executor()
    executor.init_app(app)
    assert 'executor' in app.extensions
    assert isinstance(executor._executor, concurrent.futures._base.Executor)
Beispiel #4
0
import shutil

from flask import Flask, render_template, redirect, url_for, flash, current_app, request
from flask_socketio import SocketIO

from flask_executor import Executor
from templates.forms import Form_Generate
from PDFGen.makepdf import make_pdf
from MailGen.makemail import makemail

executor = Executor()
app = Flask(__name__)
app.config['SECRET_KEY'] = 'Sup>.er"3uhedoa()U*yuoehdoSeceteyQacijas92*()!'

executor.init_app(app)
socketio = SocketIO(app)

clients = []


@executor.job
def ProcessData(auditor_name, email, yearend, client_name, client_signatory,
                samplesize, datafile, letter_head, signature_file):
    if os.path.exists(os.path.join(current_app.root_path, "static",
                                   "out.zip")):
        os.remove(os.path.join(current_app.root_path, "static", "out.zip"))
    df_Debtors = pd.read_excel(os.path.join(current_app.root_path,
                                            "DataSource", "DebtorsList.xlsx"),
                               sheet_name=0)
    df_Contact = pd.read_excel(os.path.join(current_app.root_path,
def test_factory_init(app):
    executor = Executor()
    executor.init_app(app)
    assert 'executor' in app.extensions