예제 #1
0
파일: tasks.py 프로젝트: jmblakl/test-suite
def run_tests(room, vendor, tags, override):
    app = create_app()
    with app.app_context():
        test_run = TestRun()
        db.session.add(test_run)
        db.session.commit()

        def on_snapshot(snapshot, plan):
            test_run.save_snapshot(snapshot, plan)
            socketio.emit('snapshot', test_run.event, room=room)

            db.session.commit()

        try:
            output = io.StringIO()
            output_stream = StreamOpener(stream=output)
            config = Configuration(
                outputs=[output_stream],
                format=['json.chunked'],
                on_snapshot=on_snapshot,
                vendor=vendor,
                override=override,
                command_args=[],
                tags=[','.join(tags)],
            )
            runner = Runner(config)

            runner.run()
        except Exception as err:  # pylint: disable=broad-except
            socketio.emit('global_error', str(err), room=room)
        finally:
            socketio.emit('tests_complete', room=room)
예제 #2
0
def report(test_run_id):
    room = request.form['room']
    run = TestRun.query.get(test_run_id)
    event = run.event

    socketio.emit('snapshot', event, room=room)

    return jsonify(event)
예제 #3
0
def report(test_run_id):
    room = request.form['room']
    run = TestRun.query.get(test_run_id)

    try:
        event = run.event
        socketio.emit('snapshot', event, room=room)

        return jsonify(event)
    except AttributeError:
        resp = jsonify({'error': 'Test run {} not found.'.format(test_run_id)})
        resp.status_code = 404

        return resp
예제 #4
0
def run_tests(room, vendor, tags, override):
    app = create_app()
    with app.app_context():
        test_run = TestRun(vendor, tags)
        db.session.add(test_run)
        db.session.commit()

        def on_snapshot(snapshot, plan):
            test_run.save_snapshot(snapshot, plan)
            socketio.emit('snapshot', test_run.event, room=room)

            db.session.commit()

        def on_payload(payload):
            socketio.emit('payload', payload, room=room)

        try:
            output = io.StringIO()
            output_stream = StreamOpener(stream=output)
            config = Configuration(
                outputs=[output_stream],
                format=['json.chunked'],
                on_snapshot=on_snapshot,
                on_payload=on_payload,
                vendor=vendor,
                override=override,
                command_args=[],
                tags=[','.join(tags)],
            )
            runner = Runner(config)

            runner.run()
        except Exception as err:  # pylint: disable=broad-except
            import traceback
            traceback.print_exc()
            socketio.emit('global_error', str(err), room=room)
        finally:
            socketio.emit('tests_complete', room=room)
예제 #5
0
파일: tasks.py 프로젝트: narrasr/test-suite
 def on_payload(payload):
     socketio.emit('payload', payload, room=room)
예제 #6
0
파일: tasks.py 프로젝트: narrasr/test-suite
        def on_snapshot(snapshot, plan):
            test_run.save_snapshot(snapshot, plan)
            socketio.emit('snapshot', test_run.event, room=room)

            db.session.commit()
예제 #7
0
 def on_payload(payload):
     socketio.emit('payload', payload, room=room)
예제 #8
0
        def on_snapshot(snapshot, plan):
            test_run.save_snapshot(snapshot, plan)
            socketio.emit('snapshot', test_run.event, room=room)

            db.session.commit()