Exemple #1
0
def format_survival_rate():
    """cr-rate

Usage: cr-rate

Read JSON work-records from stdin and print the survival rate.
"""
    records = (WorkItem(json.loads(line, cls=WorkItemJsonDecoder)) for line in sys.stdin)
    print('{:.2f}'.format(survival_rate(records)))
Exemple #2
0
def test_empty___init__(project_root):
    config = 'cosmic-ray.empty.conf'
    session = 'empty_test.session.json'

    subprocess.check_call(['cosmic-ray', 'init', config, session],
                          cwd=str(project_root))

    session_path = project_root / session
    with use_db(str(session_path), WorkDB.Mode.open) as work_db:
        rate = survival_rate(work_db.work_items)
        assert rate == 0.0
Exemple #3
0
def test_e2e(project_root, test_runner, engine):
    config = 'cosmic-ray.{}.{}.conf'.format(test_runner, engine)
    session = 'adam-tests.{}.{}.session.json'.format(test_runner, engine)

    subprocess.check_call(['cosmic-ray', 'init', config, session],
                          cwd=str(project_root))
    subprocess.check_call(['cosmic-ray', 'exec', session],
                          cwd=str(project_root))

    session_path = project_root / session
    with use_db(str(session_path), WorkDB.Mode.open) as work_db:
        rate = survival_rate(work_db.work_items)
        assert rate == 0.0