예제 #1
0
        ctx.run("mkdocs gh-deploy", title="Deploying documentation", pty=PTY)


@duty(silent=True)
def coverage(ctx):
    """
    Report coverage as text and HTML.

    Arguments:
        ctx: The context instance (passed automatically).
    """
    ctx.run("coverage report --rcfile=config/coverage.ini", capture=False)
    ctx.run("coverage html --rcfile=config/coverage.ini")


@duty(pre=[duty(lambda ctx: ctx.run("rm -f .coverage", silent=True))])
def test(ctx, match=""):
    """
    Run the test suite.

    Arguments:
        ctx: The context instance (passed automatically).
        match: A pytest expression to filter selected tests.
    """
    ctx.run(
        [
            "pytest", "-c", "config/pytest.ini", "-n", "auto", "-k", match,
            "tests"
        ],
        title="Running tests",
        pty=PTY,
예제 #2
0
import base64
import json
import db
import time

app.config.from_object(Table)
fields_job = app.config.get('FIELDS_OPS_JOBS')
fields_user = app.config.get('FIELDS_USER')
ISOTIMEFORMAT = '%Y-%m-%d %X'
''' 
{'0':'未处理','1':'处理中','2':'完成','3':'失败'}
'''

# 获取值班人邮件地址和密码
today = date.weekday(date.today())
duty_email = db.list('users', fields_user, duty(today))['email']
duty_passwd = base64.b64decode(
    db.list('users', fields_user, duty(today))['email_password'])


@app.route('/joblist/')
@login_request.login_request
def joblist():
    role = session.get('role')
    jobs = db.list('ops_jobs', fields_job)
    list_jobs = []
    for job in jobs:
        if job['status'] == 0 or job['status'] == 1:
            list_jobs.append(job)
    return render_template("/job/joblist.html", jobs=list_jobs, role=role)
예제 #3
0
def nds(value):
    return ceil(((value + duty(value)) * 20) / 100)