Exemplo n.º 1
0
def test_reset():
    """Verify that BuildSpace reset() delete expected content."""
    bs = BuildSpace(root_dir=os.getcwd(), primitive='build')
    bs.create()
    for name in bs.dirs:
        touch(os.path.join(bs.get_subdir(name), 'a'))

    # Reset delete all dirs except log and result by default
    bs.reset()
    for name in bs.dirs:
        exists = os.path.exists(os.path.join(bs.get_subdir(name), 'a'))
        if name in ('log', 'results'):
            assert exists
        else:
            assert not exists
Exemplo n.º 2
0
def test_reset_tmp_dir():
    """Check that the tmp_dir is reset when the build space is created.

    REQ-EC19.
    """
    bs = BuildSpace(root_dir=os.getcwd(), primitive='build')
    marker = os.path.join(bs.get_subdir(name='tmp'), 'deleteme')
    mkdir(bs.tmp_dir)
    touch(marker)
    assert os.path.exists(marker)
    bs.create()
    assert not os.path.exists(marker)
Exemplo n.º 3
0
def test_subdir():
    """Check error handling of get_subdir."""
    bs = BuildSpace(root_dir=os.getcwd(), primitive='build')
    with pytest.raises(ValueError):
        bs.get_subdir('foo')