Esempio n. 1
0
def test_compare(capsys, tmpdir, example_results):
    tmpdir = six.text_type(tmpdir)
    os.chdir(tmpdir)

    conf = config.Config.from_json({
        'results_dir': example_results,
        'repo': tools.generate_test_repo(tmpdir).path,
        'project': 'asv',
        'environment_type': "shouldn't matter what"
    })

    tools.run_asv_with_conf(conf, 'compare', '22b920c6', 'fcf8c079',
                            '--machine=cheetah', '--factor=2',
                            '--environment=py2.7-numpy1.8')

    text, err = capsys.readouterr()
    assert text.strip() == REFERENCE.strip()

    tools.run_asv_with_conf(conf, 'compare', '22b920c6', 'fcf8c079',
                            '--machine=cheetah', '--factor=2', '--split',
                            '--environment=py2.7-numpy1.8')
    text, err = capsys.readouterr()
    assert text.strip() == REFERENCE_SPLIT.strip()

    # Check print_table output as called from Continuous
    status = Compare.print_table(conf,
                                 '22b920c6',
                                 'fcf8c079',
                                 factor=2,
                                 machine='cheetah',
                                 split=False,
                                 only_changed=True,
                                 sort='ratio',
                                 env_names=["py2.7-numpy1.8"],
                                 commit_names={
                                     '22b920c6': 'name1',
                                     'fcf8c079': 'name2'
                                 })
    worsened, improved = status
    assert worsened
    assert improved
    text, err = capsys.readouterr()
    assert text.strip() == REFERENCE_ONLY_CHANGED.strip()

    # Check table with multiple environments
    status = Compare.print_table(conf,
                                 '22b920c6',
                                 'fcf8c079',
                                 factor=2,
                                 machine='cheetah',
                                 split=False,
                                 only_changed=True,
                                 sort='ratio')
    text, err = capsys.readouterr()
    assert text.strip() == REFERENCE_ONLY_CHANGED_MULTIENV.strip()
Esempio n. 2
0
def test_compare(capsys, tmpdir):
    tmpdir = six.text_type(tmpdir)
    os.chdir(tmpdir)

    conf = config.Config.from_json(
        {'results_dir': RESULT_DIR,
         'repo': tools.generate_test_repo(tmpdir).path,
         'project': 'asv',
         'environment_type': "shouldn't matter what"})

    tools.run_asv_with_conf(conf, 'compare', '22b920c6', 'fcf8c079', '--machine=cheetah',
                            '--factor=2')

    text, err = capsys.readouterr()
    assert text.strip() == REFERENCE.strip()

    tools.run_asv_with_conf(conf, 'compare', '22b920c6', 'fcf8c079', '--machine=cheetah',
                            '--factor=2', '--split')

    text, err = capsys.readouterr()
    assert text.strip() == REFERENCE_SPLIT.strip()

    # Check print_table output as called from Continuous
    status = Compare.print_table(conf, '22b920c6', 'fcf8c079', factor=2, machine='cheetah',
                                 split=False, only_changed=True, sort_by_ratio=True)
    worsened, improved = status
    assert worsened
    assert improved
    text, err = capsys.readouterr()
    assert text.strip() == REFERENCE_ONLY_CHANGED.strip()
Esempio n. 3
0
def test_compare(tmpdir):

    tmpdir = six.text_type(tmpdir)
    os.chdir(tmpdir)

    conf = config.Config.from_json({
        'results_dir': RESULT_DIR,
        'repo': 'https://github.com/spacetelescope/asv.git',
        'project': 'asv'
    })

    s = StringIO()
    stdout = sys.stdout

    try:
        sys.stdout = s
        Compare.run(conf, '22b920c6', 'fcf8c079', machine='cheetah')
    finally:
        sys.stdout = stdout

    s.seek(0)
    assert s.read().strip() == REFERENCE.strip()