Ejemplo n.º 1
0
def test_rm(tmpdir):
    tmpdir = six.text_type(tmpdir)

    shutil.copytree(
        join(dirname(__file__), 'example_results'),
        join(tmpdir, 'example_results'))

    conf = config.Config.from_json({
        'results_dir': join(tmpdir, 'example_results'),
        'repo': "### IGNORED, BUT REQUIRED ###"
        })

    tools.run_asv_with_conf(conf, 'rm', '-y', 'benchmark=time_quantity*')

    results_a = list(results.iter_results(tmpdir))
    for result in results_a:
        for key in six.iterkeys(result.results):
            assert not key.startswith('time_quantity')
        for key in six.iterkeys(result.started_at):
            assert not key.startswith('time_quantity')
        for key in six.iterkeys(result.ended_at):
            assert not key.startswith('time_quantity')

    tools.run_asv_with_conf(conf, 'rm', '-y', 'commit_hash=05d283b9')

    results_b = list(results.iter_results(tmpdir))
    assert len(results_b) == len(results_a) - 1
Ejemplo n.º 2
0
def test_iter_results(capsys, tmpdir, example_results):
    dst = os.path.join(six.text_type(tmpdir), 'example_results')
    shutil.copytree(example_results, dst)

    path = os.path.join(dst, 'cheetah')

    skip_list = [
        'machine.json',
        'aaaaaaaa-py2.7-Cython-numpy1.8.json',  # malformed file
        'bbbbbbbb-py2.7-Cython-numpy1.8.json',  # malformed file
        'cccccccc-py2.7-Cython-numpy1.8.json',  # malformed file
    ]

    files = [
        f for f in os.listdir(path)
        if f.endswith('.json') and f not in skip_list
    ]
    res = list(results.iter_results(path))
    assert len(res) == len(files)
    out, err = capsys.readouterr()
    assert skip_list[1] in out
    assert skip_list[2] in out
    assert skip_list[3] in out
    assert skip_list[0] not in out

    # The directory should be ignored without machine.json
    os.unlink(os.path.join(path, 'machine.json'))
    res = list(results.iter_results(path))
    assert len(res) == 0
    out, err = capsys.readouterr()
    assert "machine.json" in out
Ejemplo n.º 3
0
def test_rm(tmpdir):
    tmpdir = six.text_type(tmpdir)

    shutil.copytree(
        join(dirname(__file__), 'example_results'),
        join(tmpdir, 'example_results'))

    conf = config.Config.from_json({
        'results_dir': join(tmpdir, 'example_results'),
        'repo': "### IGNORED, BUT REQUIRED ###"
        })

    tools.run_asv_with_conf(conf, 'rm', '-y', 'benchmark=time_quantity*')

    results_a = list(results.iter_results(tmpdir))
    for result in results_a:
        for key in result.result_keys:
            assert not key.startswith('time_quantity')
        for key in six.iterkeys(result.started_at):
            assert not key.startswith('time_quantity')
        for key in six.iterkeys(result.ended_at):
            assert not key.startswith('time_quantity')

    tools.run_asv_with_conf(conf, 'rm', '-y', 'commit_hash=05d283b9')

    results_b = list(results.iter_results(tmpdir))
    assert len(results_b) == len(results_a) - 1
Ejemplo n.º 4
0
def test_iter_results(capsys, tmpdir):
    src = os.path.join(os.path.dirname(__file__), 'example_results')
    dst = os.path.join(six.text_type(tmpdir), 'example_results')
    shutil.copytree(src, dst)

    path = os.path.join(dst, 'cheetah')

    skip_list = [
        'machine.json',
        'aaaaaaaa-py2.7-Cython-numpy1.8.json', # malformed file
        'bbbbbbbb-py2.7-Cython-numpy1.8.json', # malformed file
        'cccccccc-py2.7-Cython-numpy1.8.json', # malformed file
    ]

    files = [f for f in os.listdir(path) if f.endswith('.json') and f not in skip_list]
    res = list(results.iter_results(path))
    assert len(res) == len(files)
    out, err = capsys.readouterr()
    assert skip_list[1] in out
    assert skip_list[2] in out
    assert skip_list[3] in out
    assert skip_list[0] not in out

    # The directory should be ignored without machine.json
    os.unlink(os.path.join(path, 'machine.json'))
    res = list(results.iter_results(path))
    assert len(res) == 0
    out, err = capsys.readouterr()
    assert "machine.json" in out
Ejemplo n.º 5
0
def test_rm(tmpdir, example_results):
    tmpdir = str(tmpdir)

    shutil.copytree(example_results, join(tmpdir, 'example_results'))

    conf = config.Config.from_json({
        'results_dir':
        join(tmpdir, 'example_results'),
        'repo':
        "### IGNORED, BUT REQUIRED ###"
    })

    tools.run_asv_with_conf(conf, 'rm', '-y', 'benchmark=time_quantity*')

    results_a = list(results.iter_results(tmpdir))
    for result in results_a:
        for key in result.get_all_result_keys():
            assert not key.startswith('time_quantity')
        for key in result.started_at.keys():
            assert not key.startswith('time_quantity')
        for key in result.duration.keys():
            assert not key.startswith('time_quantity')

    tools.run_asv_with_conf(conf, 'rm', '-y', 'commit_hash=05d283b9')

    results_b = list(results.iter_results(tmpdir))
    assert len(results_b) == len(results_a) - 1
Ejemplo n.º 6
0
def test_iter_results(
    capsys, tmpdir, example_results
):  # noqa F811 noqa F811 redefinition of the imported fixture,it can be removed when the fixture is moved to conftest.py file and the import deleted
    dst = os.path.join(str(tmpdir), 'example_results')
    shutil.copytree(example_results, dst)

    path = os.path.join(dst, 'cheetah')

    skip_list = [
        'machine.json',
        'aaaaaaaa-py2.7-Cython-numpy1.8.json',  # malformed file
        'bbbbbbbb-py2.7-Cython-numpy1.8.json',  # malformed file
        'cccccccc-py2.7-Cython-numpy1.8.json',  # malformed file
    ]

    files = [
        f for f in os.listdir(path)
        if f.endswith('.json') and f not in skip_list
    ]
    res = list(results.iter_results(path))
    assert len(res) == len(files)
    out, err = capsys.readouterr()
    assert skip_list[1] in out
    assert skip_list[2] in out
    assert skip_list[3] in out
    assert skip_list[0] not in out

    # The directory should be ignored without machine.json
    os.unlink(os.path.join(path, 'machine.json'))
    res = list(results.iter_results(path))
    assert len(res) == 0
    out, err = capsys.readouterr()
    assert "machine.json" in out
Ejemplo n.º 7
0
def test_rm(tmpdir):
    tmpdir = six.text_type(tmpdir)

    shutil.copytree(
        join(dirname(__file__), 'example_results'),
        join(tmpdir, 'example_results'))

    conf = config.Config.from_json({
        'results_dir': join(tmpdir, 'example_results'),
        'repo': "https://github.com/astropy/astropy.git"
        })

    Rm.run(conf, ['benchmark=time_quantity*'])

    results_a = list(results.iter_results(tmpdir))
    for result in results_a:
        for key in six.iterkeys(result.results):
            assert not key.startswith('time_quantity')

    Rm.run(conf, ['commit_hash=05d283b9'])

    results_b = list(results.iter_results(tmpdir))
    assert len(results_b) == len(results_a) - 1